public class YangHui {
public static void main(String[] args){
int yangHui[][] = new int[10][];
for (int i = 0; i < yangHui.length;i++){
yangHui[i] = new int[i + 1];
for (int j = 0; j < yangHui[i].length; j++){
// 最初和最后的数值都是1
if (j == 0 || j == yangHui[i].length -1){
yangHui[i][j] = 1;
}else{
// 上一行中间相加=下一行中间数值
yangHui[i][j] = yangHui[i - 1][j] + yangHui[i - 1][j - 1];
}
}
}
for (int i = 0; i < yangHui.length; i++){
for (int j = 0; j < yangHui[i].length; j++){
System.out.print(yangHui[i][j] + "\t");
}
System.out.println();
}
}
}