#include
#include
int shu(long unsigned num) //判断素数函数,是,返回1.否,0
{
int t,i;
t=sqrt(num)+1;
for(i=2;i
if(num%i==0)
break;
}
return i==t;
}
int main()
{
int i,k=0,n=300;
for(i=3;i
{
k++;
printf("%.3d ",i); //格式输出,三位整数
if(k%5==0)printf("\n"); //一行超过5个则换行
}
}
#include
void main()
{
int i,j,k,min=3,max=100,temp=1;
for(i=min;i<=max;i++)
{
for(j=2;j<=i/2+1;j++)
{
if(i%j==0)
break;
}
if (j > i/2+1){
temp++;
printf("%d",i);
}
if(temp==5){
temp=1;
printf("\n");
}
}
}
#include
int main(void)
{
int i, j, n = 0;
for (i = 3; i <= 100; i++)
{
x = 0;
for (j = 2; j < i; j++)
{
if (i % j == 0)
{
x = 1;
}
}
if (x == 0)
{
n++;
printf("%d ", i);
if (n == 5)
{
printf("\n");
}
}
}
return 0;
}
#include
void main()
{
int i, j, x,n = 0;
for (i = 3; i <= 100; i++)
{
x = 0;
for (j = 2; j < i; j++)
if (i % j == 0)
x = 1;
if (x == 0)
{
n++;
printf("%d ,", i);
if (n%5==0)
printf("\n");
}
}
}
(本来想把结果截上去的,可是等级不够,不让我截)