HNDIT
Tuesday, December 18, 2012
THE FACTORS OF THE NUMBER IN C++
#include<iostream.h>
void main ()
{
int num, fact, gfact;
cout<<"ENTER A NUMBER : ";
cin >> num;
gfact=num/2;
cout<<"THE FACTORS OF " << num << " ARE : " << endl;
for ( fact=1; fact<=gfact; fact=fact+1)
{
if (num%fact==0)
cout << fact << endl;
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment