Code Box
------------------------------------
/* Program to find factor of any number */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num,i;
cout<<"\n---------Factor Finder--------";
cout<<"\nEnter a number:";
cin>>num;
cout<<"\nFactors of "<<num<<" are : ";
for(i=1;i<num;i++)
{
if(num%i==0)
{
cout<<" "<<i;
}
}
getch();
}
No comments:
Post a Comment