#include<"stdio.h">
main()
{
int input, loop =2, rem, flag = 0;
printf("enter a number : ");
scanf("%d",&input);
if(input==1)
{printf("not a prime");}
else
{
while(loop{
rem=input%loop;
if(rem==0)
{
printf("Not a Prime");
loop=input;
flag =1 ;
}
loop++; // loop = loop + 1
}
if(flag==0)
{printf(Yes its prime number");}
}
}
No comments:
Post a Comment