2018-05-14 14:32:13         来源：Pin_na

```#define _CRT_SECURE_NO_WARNINGS 1
#include
int main()
{
int i = 0;
int j = 0;
int count = 0;//定义计数器
for (i = 100; i <= 200; i++)
{
for (j = 2; j <= i - 1; j++)
{
if (i%j == 0)//判断是否整除
{
break;//整除则不是素数，跳出循环开始验证下一个数
}
}
if (i == j)//仅能被自身整除
{
printf("%d ", i);
count++;
}
}
printf("\n");
printf("count=%d\n", count);
system("pause");
return 0;
}```

```#define _CRT_SECURE_NO_WARNINGS 1
#include
int main()
{
int i = 0;
int j = 0;
int n = 0;
int count = 0;
for (i = 100; i <= 200; i++)
{
n = i / 2;//储存i/2用来比较
for (j = 2; j <= n; j++)
{
if (i%j == 0)
{
break;
}
}
if (j > n)
{
printf("%d ", i);
count++;
}
}
printf("\n");
printf("count=%d\n", count);
system("pause");
return 0;
}```

```#define _CRT_SECURE_NO_WARNINGS 1
#include
#include
int main()
{
int i = 0;
int j = 0;
int n = 0;
int count = 0;
for (i = 100; i <= 200; i++)
{
n = sqrt(i);//储存i的平方根用来比较
for (j = 2; j <= n; j++)
{
if (i%j == 0)
{
break;
}
}
if (j > n)
{
printf("%d ", i);
count++;
}
}
printf("\n");
printf("count=%d\n", count);
system("pause");
return 0;
}
```

```#define _CRT_SECURE_NO_WARNINGS 1
#include
#include
int main()
{
int i = 0;
int j = 0;
int n = 0;
int count = 0;
for (i = 101; i <= 200; i += 2)//i从101开始，每次循环时+2
{
n = sqrt(i);
for (j = 2; j <= n; j++)
{
if (i%j == 0)
{
break;
}
}
if (j > n)
{
printf("%d ", i);
count++;
}
}
printf("\n");
printf("count=%d\n", count);
system("pause");
return 0;
}
```