int[][] triangle = new int[6][6];
int i, j, k = 0;
for (i = 0; i < triangle.length; i++) {
triangle[i][0] = 1;
triangle[i][i] = 1;
}
for (i = 2; i < triangle.length; i++) {
for (j = 1; j <= i; j++) {
triangle[i][j] = triangle[i - 1][j] + triangle[i - 1][j - 1];
}
}
for (i = 0; i < triangle.length; i++) {
for (k = 0; k < 5 - i; k++) {
System.out.print(" ");
}
for (j = 0; j <= i; j++) {
System.out.print(triangle[i][j] + " ");
}
System.out.print("
");
}