C++ PROGRAM TO DISPLAY THE FACTORS OF THE ENTERED NUMBER
/*C++ PROGRAM TO DISPLAY THE FACTORS OF THE ENTERED NUMBER */
#include<iostream.h>
using namespace std;
intmain()
{
int number, temp =1;
cout<<"Enter the number to determine its factors : "<<endl;
cin>> number;
cout<<"The factors of "<< number <<" are : "<<endl;
while(temp <= number)
{
if(not(number % temp))
cout<< temp <<" ";
temp++;
}
cout<<endl;
}
Output :-
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment