好吧!我试试,谢哈!
#include <stdio.h> #include <math.h> #include <stdlib.h> int judge(__int64 a); int main(void) { __int64 a; while (scanf("%lld", &a) != EOF) { if (judge(a) == 1) printf("It is a prime number.\n"); else printf("It is not a prime number.\n"); } system("pause"); return 0; } int judge(__int64 a) { __int64 i, b = (int)sqrt((float)a); for (i = 2; i <= b; i++) if (a % i == 0) break; return (i == b + 1); }