//C++ program to find factors of a number
#include <iostream>
using namespace std;
int main()
{
int number,i ;
cout << "Enter the number to find its factors : ";
cin >> number;
cout << "The factors of " << number << " are : ";
for(i=1;i<number;i++)
{
if(number%i==0)
{
cout<<i<<" ";
}
}
cout << endl;
return 0;
}
No comments:
Post a Comment