/*
输出 n=6 的三角数字阵
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
*/
class TriangleDemo
{
public static void main(String[] args)
{
int n=0;
for (int x=1;x<7 ;x++ )
{
for (int y=1;y<=x ;y++ )
{
System.out.print(++n+"\t");
}
System.out.println();
}
//System.out.println("Hello World!");
}
}
|