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