#includee
#include
void main()
{
int num=0,k=0,i;
clrscr();
cout<<"Enter the value of num";
cin>>num;
for(i=2;i<=num-1;i++)
{
k=num%i;
if(k==0)
{
break;
}
else
{
continue;
}
}
if(k==1)
{
cout<<"Given num is prime" ;
}
else
{
cout<<"Given num is not prime";
}
getch();
}
No comments:
Post a Comment