if(n%2==0){printf("not prime.");exit(0);}
for(i=3; i<sqrt(n); i+=2)
if(n%i==0){printf("not prime.");exit(0);}
printf("PRIME No.");
じゃ駄目か?