您的位置:首页 > 其它

打印100~200 之间的素数

2018-03-20 08:35 218 查看
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int i = 0;
int count = 0;
for (i = 101; i <= 200; i = i + 2)
{
int j = 0;
for (j = 2; j <= sqrt(i); j++)
{
if (i%j == 0)
break;
}
if (j>sqrt(i))
{
count++;
printf("%d ", i);
}
}
printf("\ncount=%d", count);
system("pause");
return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: