#include <stdio.h>
main()
{
int i,j=2,k=0;
clrscr();
printf("\nENTER ANY NUMBER");
scanf("%d",&i);
while(j<=i/2)
{
if(i%j==0)
{
printf("%d IS NOT PRIME",i);
k=1;
break;
}
else
{
j++;
}
}
if(k==0)
{
printf("%d IS PRIME",i);
}
}
main()
{
int i,j=2,k=0;
clrscr();
printf("\nENTER ANY NUMBER");
scanf("%d",&i);
while(j<=i/2)
{
if(i%j==0)
{
printf("%d IS NOT PRIME",i);
k=1;
break;
}
else
{
j++;
}
}
if(k==0)
{
printf("%d IS PRIME",i);
}
}
No comments:
Post a Comment