Multidemisional arrays

Hello,
I have a write a 5x5 two dimensional array. In which i enter values for the first column and row using for loops to prompt the me to enter the values. Then I fill in the rest of the table with values calculated by summing the values in the table cell above and the table cell to the left of each cell.
5x5 matrix:

1
2
3
4
5
array[0] = {0, 1, 2, 3, 4}
array[1] = {0, 1, 2, 3, 4}
array[2] = {0, 1, 2, 3, 4}
array[3] = {0, 1, 2, 3, 4}
array[4] = {0, 1, 2, 3, 4}


The kth row of the matrix corresponds to array[k- 1]. The jth element in the kth row corresponds to the element array[k - 1][j - 1].

You can visit all elements of the matrix by using a nested loop in which the outer loop will loop over all the arrays and the inner loop will loop over each element of the current array

1
2
3
for k = 1 : 5
    for j = 1 : 5
        print array[k - 1][j -1]
Topic archived. No new replies allowed.