Question: Document the arrays, using a chart with columns titled:outer loop, inner loop, i, j, and x. Finally, draw a picture of each array (after the

Document the arrays, using a chart with columns titled:outer loop, inner loop, i, j, and x. Finally, draw a picture of each array (after the program portion has executed).

int[][] arr1 = new int[5][5];

int[][] arr2 = new int[5][5];

x = 1;

for(int i = 0; I < 5; i++) {

for(int j = 1; j < 6; j++) { arr1[i][j-1] = x;

x++;

if(x == 6)

x += 2;

}

}

for(int i = 4; i >= 0; i--)

for(int j = 4; j > -1; j--) arr2[j][i] = arr1[i][j];

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!