C哪里错啦这是 一个题目复制过来的
main(){
int m, i ,k;
scanf(“%d”,&m);
k=sqrt(m+1);
for(i=2; i<=k; i++)
if(m%i = = 0)
break;
if( i >= k+1)
printf(“%d is a prime number\n”,m);
else
printf(“%d is not a prime number\n”,m);
}
程序运行,输入99,输出结果为:
#include <stdio.h> #include <math.h> int main(int argc, char *argv[]) { int m, i ,k; for (m = 0; m <= 125; m++) { for (i = 2, k = sqrt(m + 1); i <= k; i++) if(m % i == 0) break; if (i >= k + 1) printf("%d is a prime number\n", m); else printf("%d is not a prime number\n", m); } return 0; }