//求100以内的素数,全部打印出来
#include <stdio.h>
int main()
{
int i,j;
int temp;
for(i = 2;i <=100;i++)
{
int temp = 1;
for(j = 2; j < i;j++)
{
if(i % j == 0)
{
temp = 0;
break;
}
}
if(temp == 1)
{
printf("%d ",i);
}
}
return 0;
}
求100以内的素数,全部打印出来
最新推荐文章于 2020-01-24 22:16:32 发布