杨辉三角

package Yanghuisanjiao;

public class Yanghuisanjiao {
public static void main(String args[]) {
int[][] b=new int [10][10];
for (int i=0; i<10; i++) {
for (int j=0; j<10; j++) {
b[i][0]=1;
b[i][i]=1;
}
}
for(int i=1;i<10;i++)
for(int j=1;j<i;j++)
b[i][j]=b[i-1][i-1]+b[i-1][j];
for(int i=0; i<10; i++) {
for(int j=0;j<10;j++)
System.out.print(" "+b[i][j]);
System.out.println();


}
}
}

原文地址:https://www.cnblogs.com/QHNUCX/p/6633878.html