/**输出下列数字形式:
n=4
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
*/
/*方法一:行坐标x1从N--1,列坐标y从1--(2N-1);其中x2的值为1--N,y2的值为需要输出的数字,范围为:1--N;temp为临时变量,存储每一行对应的X2的值,以便输出y>N的值;*/
public class outtyle
{
public static void main(String args[])
{
final int N=10;
for(int x1=N,x2=1;x1>=1&&x2<=N;x1--,x2++)
{ int y2=1;
int temp =x2;
for(int y=1;y<=2*N-1;y++)
{
if(y<x1) System.out.print(" "+" ");
if(y>=x1&&y<=N)
{
System.out.print(y2+" ");
y2++;
}
if(y>N && temp-1!=0)
{
temp--;
System.out.print(temp+" ");
}
}
System.out.println();
}
}
}