var
i,j:longint;
begin
for i:=1 to 1000 do
begin
if (i mod 3=2) and (i mod 5=3) and (i mod 7=2) then begin inc(j); write(i,' '); end;
if j=5 then begin writeln; j:=0; end;
end;
end.
#include
void main(void)
{
int i = 0;
int k = 0;
for(i=1;i<1001;++i)
{
if(i%3==2)
{
k++;
if(k<=5)
{
printf("%d ",i);
if(k == 5)
{
k = 0;
printf("\n");
}
}
}
if(i%5==3)
{
k++;
if(k<=5)
{
printf("%d ",i);
if(k == 5)
{
k = 0;
printf("\n");
}
}
}
if(i%7==2)
{
k++;
if(k<=5)
{
printf("%d ",i);
if(k == 5)
{
k = 0;
printf("\n");
}
}
}
//scanf("%d",&a[i]);
//printf("%d,",i);
}
printf("\n",i);
}
依次求出
其中有一个23