回复 27楼 韩54521风
int s,k,i,a,b,c,d,leap=1,h=0;
for(s=2;s<10;s++)
if(s==2||s==3||s==5||s==7)
{printf("%-4d",s);h++;
if(h%10==0)printf("\n");}
for(s=10;s<100;s++)
{if(s%11==0)
{k=
(int)sqrt(s);
for(i=2;i
<=k;i++)
if(s%i==0)
{leap=0;break;}
if(leap)
{printf("%-4d",s);h++;
if(h%10==0)printf("\n");}
leap=1;
}
}
for(s=100;s<1000;s++)
{a=s/100;b=s/10%10;c=s%10;
if(a
==c)
{k=
(int)sqrt(s);
for(i=2;i
<=k;i++)
if(s%i==0)
{leap=0;break;}
if(leap)
{printf("%-4d",s);h++;
if(h%10==0)printf("\n");}
leap=1;
}}
for(s=100;s<1000;s++)
{a=s/1000;b=s/100%10;c=s%10%100;d=s%10;
if(a==d&&b==c)
{k=
(int)sqrt(s);
for(i=2;i
<=k;i++)
if(s%i==0)
{leap=0;break;}
if(leap)
{printf("%-4d",s);h++;
if(h%10==0)printf("\n");}
leap=1;
}}