How to find the Factors of a number which will be taken by the user and will print on screen in C++.
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;
int i,n;
cout<<"Enter value here: ";
cin>>n;
for(i=1;i<=n;i=i+1)
{
if(n%i==0)
cout<<i<<" is a factor of: "<<n<<endl;
}
}
You can also Search this Program by this:
No comments:
Post a Comment