#include<iostream.h>
#include<conio.h>
void main()
{
int i,num;
clrscr();
cout<<"\nEnter a number : ";
cin>>num;
i=2;
while(i<=num-1)
{
if(num%i==0)
{
cout<<"\nNot a prime no.";
break;
}
i++;
}
if(i==num)
cout<<"\nPrime number";
getch();
}
#include<conio.h>
void main()
{
int i,num;
clrscr();
cout<<"\nEnter a number : ";
cin>>num;
i=2;
while(i<=num-1)
{
if(num%i==0)
{
cout<<"\nNot a prime no.";
break;
}
i++;
}
if(i==num)
cout<<"\nPrime number";
getch();
}
0 comments:
Post a Comment