Print 2D array
3 3
1 2 3
4 5 6
7 8 9
1 2 3
1 2 3
1 2 3
4 5 6
4 5 6
7 8 9
public class solution {
public static void print2DArray(int input[][]) {
for(int i=0;i<input.length;i++)
{
for(int k=0;k<(input.length-i);k++)
{
for(int j=0;j<input[i].length;j++)
{
System.out.print(input[i][j]+" ");
}
System.out.println();
}
}
}
}
Comments
Post a Comment