第1个回答 推荐于2016-04-25
//December 17,2014 By 12052010
#include<stdio.h>
#include<math.h>
bool isPrime(int num){
for(int i=2;i<=sqrt(num);i++)
if(num%i==0) return false;
return true;
}
int main(){
int num;
printf("\nInput your num: ");
scanf("%d",&num);
if(isPrime(num))
printf("\nIt is ");
else
printf("\nNO ,it isn't");
return 0;
}本回答被提问者采纳