int main()
{
int a = 0;
int count = 0;
for (a = 100; a <= 200; a++)
{
int b = 0;
for (b = 2; b < a; b++)
{
if (a % b == 0)
{
break;
}
}
if (b == a)
{
count ++ ;
printf(" %d", a);
}
}
printf(" 总数=%d\n", count);
return 0;
}
#include<math.h>
int main()
{
int a = 0;
int count = 0;
for (a = 100; a <= 200; a++)
{
int b = 0;
for (b = 2; b <= sqrt(a); b++)
{
if (a % b == 0)
{
break;
}
}
if (b > sqrt(a))
{
count++;
printf(" %d", a);
}
}
printf(" 总数=%d\n", count);
return 0;
}
标签:count,200,int,素数,printf,100,main
From: https://blog.51cto.com/u_16329505/8182973