#include<stdio.h>
#include<math.h>
int main()
{
int i = 0;
int count = 0;
for (i = 101; i <= 199; i += 2)
{
int j = 0;
for (j = 3; j <= sqrt(i); j += 2)
{
if (i%j == 0)
{
break;
}
}
if (j >sqrt(i))
{
count++;
printf("%d ", i);
}
}
printf("count=%d\n", count);
return 0;
}
输出结果:
101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 count=21
请按任意键继续. . .