#include<conio.h>
#include<iostream.h>
void main()
{
clrscr();
int a,b,c=0,d;
cout<<"Enter the no. ";
cin>>a;
for(int i=1;i<=a;i++)
{ b=a%i;
if (b==0)
{ cout<<i<<"\n";
c++;
}
}
if (c==2)
{cout<<"This is a prime no. ";
}
else
{ cout<<"Nos. of factors = "<<c;
}
getch();
}
#include<iostream.h>
void main()
{
clrscr();
int a,b,c=0,d;
cout<<"Enter the no. ";
cin>>a;
for(int i=1;i<=a;i++)
{ b=a%i;
if (b==0)
{ cout<<i<<"\n";
c++;
}
}
if (c==2)
{cout<<"This is a prime no. ";
}
else
{ cout<<"Nos. of factors = "<<c;
}
getch();
}
No comments:
Post a Comment