参考代码:
#include <stdio.h>
int main()
{
int N,count;
scanf("%d",&N);
for(int i=2;i<=N;i++)
{
count=1;
for(int j=2;j<=i/2;j++)
{
if(i%j==0)
count=0;
}
if(count==1)
printf("%d\n",i);
}
return 0;
}
0.0分
2 人评分
Lucky Word (C++代码)浏览:937 |
众数问题 (C语言代码)浏览:3515 |
蛇行矩阵 (C++代码)(预生成结果以节省每次生成的时间)浏览:822 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:692 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:472 |
数对 (C语言代码)浏览:703 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:600 |
川哥的吩咐 (C语言代码)浏览:611 |
杨辉三角 (C语言代码)浏览:679 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:585 |