# include <stdio.h> #include<stdlib.h> int ispr(int val) //判断是否为素数,是则1,否则0; { int i; for (i=2;i<val;++i) { if (val%i==0) break; } if (i == val) return 1; else return 0; } int main(void) { int val; int m; scanf("%d",&m); if (ispr(m)) printf("This is a prime number\n\n"); else printf("This is not a prime number\n"); system("pause"); return 0; }