1.#include"math.h"
main()
{int m,i,k,flag=0;
scanf("%d",&m);
k=sqrt(m);
for(i=2;i<=k;i++)
if(m%i==0)
{flag=1;
break;}
if(flag==0)
printf("%d is a prime number\n",m);
if(flag==1)
printf("%d is not prime number\n",m);
getch();
}
2.#include"math.h"
main()
{int m,i,k;
scanf("%d",&m);
k=sqrt(m);
for(i=2;i<=k;i++)
if(m%i==0)
break;
if(i>=k+1)
printf("%d is a prime number\n",m);
else
printf("%d is not prime number\n",m);
getch();
}