#include<stdio.h>
#include<stdlib.h>
int main()
{
int a, b, c = 0;
for (a = 1; a <= 100; a++)
{
for (b = 2; b < a; b++)
{
if (a%b == 0)
break;
else
if (b == a - 1)
c = 1;
}
if (c == 1)
{
printf("%d\n", a);
c = 0;
}
}
system("pause");
return 0;
}
【c】打印1~100之间的素数
猜你喜欢
转载自blog.csdn.net/wss_yb/article/details/82752003
今日推荐
周排行