C Program to check PRIME NUMBERS
main()
{
int i,k,r,flag;
clrscr();
printf("ENTER THE NO. TO CHECK IT IS PRIME OR NOT: ");
scanf("%d",&k);
for(i=2;i<=k/2;i++)
{
r=k%i;
if(r==0)
flag=0;
else
flag=1;
}
if(flag==1)
printf("THIS IS A PRIME NO.");
else
printf("THIS IS NOT A PRIME NO.");
getch();
}
OUTPUT :
ENTER NO: 10
IT IS NOT A PRIME NO.