// 被3整除有5.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<stdio.h>
void main()
{
int i,j,k;
for(i=0;i<=9;i++)
{
if((i+5)%3==0)
{
printf("%3d %3d ",i*10+5,50+i);
k+=2;
if(k%4==0)
printf("\n");
}
for(j=0;j<=9;j++)
{
if((i+j+5)%3==0)
{
if(i!=j)
{
if((i!=5)&&(j!=5))
{
printf("%3d %3d ",500+10*i+j,500+10*j+i);
k+=2;
if(k%4==0)
printf("\n");
{
printf("%3d %3d ",100*i+10*j+5,100*i+50+j);
k+=2;
}
if(k%4==0)
printf("\n");
{
printf("%3d %3d ",100*j+10*i+5,100*j+50+i);
k+=2;
}
if(k%4==0)
printf("\n");
}
if(i==5)
{
if(k%4==1||k%4==0)
{
printf("%3d %3d %3d ",550+j,505+10*j,100*j+55);
k+=3;
if(k%4==0)
printf("\n");
}
else
{
if(k%4==2)
{
printf("%3d %3d \n
%3d ",550+j,505+10*j,100*j+55);
k+=3;
}
else
{
if(k%4==3)
{
printf("%3d \n
%3d %3d ",550+j,505+10*j,100*j+55);
k+=3;
}
}
}
if(j==5)
{}
}
if(i==j&&i!=5)
{
if(k%4==1||k%4==0)
{
printf("%3d %3d %3d ",500+10*i+i,100*i+50+i,100*i+10*i+5);
k+=3;
if(k%4==0)
printf("\n");
}
else
{
if(k%4==2)
{
printf("%3d %3d \n%3d ",500+10*i+i,100*i+50+i,100*i+10*i+5);
k+=3;
}
else
{
printf("%3d \n%3d %3d ",500+10*i+i,100*i+50+i,100*i+10*i+5);
k+=3;
}
}
}
if(i==j&&i==5)
printf("%3d ",555);
}
}
}
}
printf("\n");
}
//可以按你的要求输出~四个数字一行~其中在某些地方加空格就可以了~
//但是其中有数字是重复的~算法方面还是有些问题~