(4.16) (Finding the factors of an integer ) Write a program thatreads an integer
ID: 3613345 • Letter: #
Question
(4.16) (Finding the factors of an integer ) Write a program thatreads an integer and displays all its smallestfactors.For example, if the input integer is 120 , theoutput should be as follows : 2, 2,2,3,5.My problem is, what does it mean by its smallestfactors.and the output is confusing .my code is givenbelow..
#include <iostream>
using namespace std;
int main()
{
int number;
cout <<"Enter the integer ::";
cin >> number ;
cout <<"The factors of " << number<<" are :: ";
for(int i = 1 ; i < number; i++)
{
if(number % i == 0)
{
cout << i <<" " ;
}
}
system("pause");
return 0;
}
Explanation / Answer
please rate - thanks you are looking for the prime factors of the number #include int main() { long int input, sum=0; coutinput; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.