its showing error.plz help
Https://ide.codingblocks.com/s/121606
- Remove the print lines from your input function.
System.out.print(" "); System.out.println();
- In this for loop, the value of i will go till n before the loop breaks (it will break at n) but before breaking it will try to access arr[n].length where arr[n] will be an out of bound index, so it will give error. So change this statement:
for (int i = 0; i < arr[i].length; i++) {
to this :
for (int i = 0; i < arr[0].length; i++) {