/*
---------------------
1
121
12321
1234321
---------------------
*/
class ForForDemo
{
public static void main(String[] args)
{
for ( int i = 1 ; i <= 4 ; i++ )
{
for (int j = 0 ; j < 4 - i ; j++)
{
System.out.print(" ");
}
for (int x = 0 ; x <= i ; x++)
{
System.out.print(x);
}
for (int y = i - 1 ; y >= 1 ; y--)
{
System.out.print(y);
}
System.out.println();
}
}
}
看起来怎么那么不得劲儿呢?
|
|