In: Computer Science
Trace (show the steps) the outer loops and draw the final array. In your documentation, use a chart with columns titled: outer loop, inner loop, counter, a, b. Assume the array is six (6) rows, seven (7) columns and filled with zeros (0s) when started.
counter = 1; for(int a = 1; a < 6; a++) { for(int b = 5; b >= 0; b--) { if(b %a == 0) { arr[a][b] = counter; counter++; } else { arr[b][a] = counter; counter--; } } }