C++ Program to Find Sum of Diagonals of Matrix

Here is the C++ program to find the sum of diagonals of a matrix.

The matrix should be a square matrix.

 

Output

Enter size of the square matrix(max 5):

3

1 2 3

4 5 6

7 8 9

Sum of 1st diagonal is 15

Sum of 2nd diagonal is 15

6 thoughts on “C++ Program to Find Sum of Diagonals of Matrix

  1. sm sameer

    in 15 th line there is a extra bracket ……………….

    Reply
  2. Nitin Joshi

    Its but the size of page is small and not able to get whole program like in last 2 cout.

    Reply

Leave a Reply

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