public class triangle { public static void main(String args[]){ YHtriangle(); } private static void YHtriangle(){ int n = 11; int [][]trian = new int[100][100]; for(int i = 0; i < n; i++){ for(int j=0; j<i; j++){ if(i<2){ trian[i][j]=1; } else{ trian[i][0]=1; for(j=1; j<i-1; j++){ trian[i][j]=trian[i-1][j-1]+trian[i-1][j]; } trian[i][j]=1; } } } for(int i=0; i<n; i++){ //for(int count = 0; count<(n-i); count++){ // System.out.print(" "); //} for(int j=0; j<i; j++){ System.out.print(trian[i][j]+ " "); } System.out.println(""); } }}