#include<stdio.h>int main(){ int i; int a; int n; for(i=0;i<n;i++) {scanf("%d",&n); for(a=2;a<=n/2;a++) if(n%a==0) break; if(a>n/2&&n!=1) printf("%d is a prime.\n",n); else printf("%d not a prime.\n",n);} return 0;}我这么打哪里错了呢
2 回答
晚安sp
TA贡献405条经验 获得超154个赞
#include<stdio.h> int main() { int i; int a; int n; scanf("%d",&n); for(i=0;i<n;i++) { for(a=2;a<=n/2;a++) if(n%a==0) break; if(a>n/2&&n!=1) printf("%d is a prime.\n",n); else printf("%d not a prime.\n",n);} return 0; }
- 2 回答
- 0 关注
- 3984 浏览
添加回答
举报
0/150
提交
取消