阿旭_
public class Test71 {
public static void main(String[] args) {
int[][] arr = new int[10][10];
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j <= i; j++) {
if (j == 0 || i == j) {
arr[i][j] = 1;
continue;
}
arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j];
}
}
for (int i = 0; i < arr.length; i++) {// 打印
for (int j = 0; j < arr.length - i; j++) {// 空格
System.out.print(" ");
}
for (int j = 0; j <= i; j++) {// 数字
System.out.printf("%-4d", arr[i][j]);
}
System.out.println();// 换行
}
}
}