C語言源碼: [cpp #include<stdio.h> #include<math.h> int judge(int n) { int i; i=2; while(i<=(int)sqrt(n)) { if(n/i*i==n) return 0; i++; } return 1; } int main() { int n; while(scanf("%d",&n)!=EOF) { if(n<=1||judge(n)==0) printf("no\n"); else printf("yes\n"); } }