Import java.util.scanner;
Public class three cross {
Public static void main(String[] args) {
System.out.println ("Please enter the maximum number of triangles:");
Scanner input = new scanner (system. in);
int max = integer . value of(input . next()); //Convert the string to int type.
int k = max
int n =(max- 1)* 2+ 1; //number of rows
int[][]array = new int[max][n];
for(int I = max; I>0; I-){// Loop from the last line.
array[I- 1][k- 1]= max; //locate the middle position
int s = 1;
for(int j = max- 1; j & gt0; j - ) {
s++;
array[I- 1][k-s]= j;
array[I- 1][k-2+s]= j; //Assign left and right values at the same time
}
max-;
}
for(int I = 0; I & ltk;; i++) {
for(int j = 0; j & ltn; j++) {
if (array[i][j]! = 0)
system . out . print(array[I][j]);
Otherwise {
system . out . print(" "); //Turn zero into a space
}
}
system . out . println(" "); //newline
}
}
}