2D Array help pls | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

2D Array help pls

The expected output looks something like this: Enter number of rows: 3 Enter number of columns: 3 Enter element at row 0, column 0: 1 Enter element at row 0, column 1: 2 Enter element at row 0, column 2: 3 Enter element at row 1, column 0: 4 Enter element at row 1, column 1: 5 Enter element at row 1, column 2: 6 Enter element at row 2, column 0: 7 Enter element at row 2, column 1: 8 Enter element at row 2, column 2: 9 9 8 7 6 5 4 3 2 1 Here is my code https://code.sololearn.com/c7MmfHQnkpbu/?ref=app

15th Sep 2023, 9:57 AM
Angelmar Dayangco
Angelmar Dayangco - avatar
1 Answer
+ 4
Hint: a possible way is just to save of input values from the back of the array, of course if a swap function is not required. Another way is to map a 2D array to 1D. The index number of 1D array is f(row, col) a function of row and col.
15th Sep 2023, 2:59 PM
JaScript
JaScript - avatar