Problem Solving: 2-D Matrix Diagonals Sums
Learn how multi-dimensional arrays can be used in different operations.
Diagonal by diagonal sum
Write a program that does the following:
- Load the matrix.
- Calculate the sum of each diagonal.
- Save each diagonal sum of the 2-D matrix to a 1-D array.
- Display each diagonal sum.
For example, let’s take We have the following matrix and compute the sum of each diagonal.
Get hands-on with 1200+ tech skills courses.