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

By | March 25, 2013

Here is the simple C program to find sum of elements above and below main diagonal of matrix. The matrix should be square matrix.

 

Output

How many rows and columns:3 3
Enter matrix elements:
4 12 7
4 5 2
1 0 3

Sum of elements above the diagonal=21
Sum of elements below the diagonal=5