1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
class SanJiao
{
public static void main(String[] args)
{
int a=1;
int b=0;
int c=0;
for (int x=1;x<=9 ;x++ )
{
b=x;
for (int z=x;z<9 ; z++)
{
System.out.print(" ");
}
for (int y=1;y<=a ;y++ )
{
if (y<=x)
{
System.out.print(y+" ");
}
else if (y>x)
{
b--;
System.out.print(b+" ");
}
}
a+=2;
c++;
System.out.println();
}
}
}
|