C++ Program to Find Sum of Elements Above and Below Main Diagonal of Matrix

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

 

Output

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

1 thought on “C++ Program to Find Sum of Elements Above and Below Main Diagonal of Matrix”

Leave a Comment

Your email address will not be published. Required fields are marked *