Program # 24: Program to find out factors of given number
//Program to find out the factors of given number(Level - Medium)
#include <iostream.h>
#include <conio.h>
#include <conio.h>
void main ()
{
clrscr();
int n,i,j,res;
cout<<"Enter any number
= ";
cin >> n;
cin >> n;
for(i=1;i<=20;i++)
for(j=2;j<=i;j++)
if(n%j==0)
{
cout<<j<<endl; n = n/j;
}
getch ();
}
0 Comments