C++ Program to Find Sum of Elements Above and Below Main Diagonal of Matrix1 min read

Here is the C++ program to find sum of elements above and below the main diagonal of square matrix.


Enter size of matrix(max 5):3
Enter the matrix:
1 2 3
4 5 6
3 0 2

Sum of elements above the diagonal:11
Sum of elements below the diagonal:7

Leave a Comment