编译器:VS2019
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
//for循环遍历100-200
//函数
//判断,打印
int is_prime(int x)
{
int j = 0;
for (j = 2; j <= sqrt(x); j++)
{
if (x % j == 0)
return 0;
}
return 1;
}
int main()
{
int i = 0;
int count = 0;
for (i = 101; i <= 200; i+=2)
{
if (is_prime(i))
{
printf("%d ", i);
count++;
}
}
printf("\n%d", count);
return 0;
}