C++ program to show sum of main diagonal elements

C++ program to show sum of main diagonal elements by using nested for loop.

Let’s see the declaration flow table of the given program.

Variables and arrays Declaration Initialization Use line number
a[size][size] 6 13 18
row 7 9A|9C|16A|16C 9B|16B
col 7 11A|11C 11B
sum 7 7|18 20
size 5 5 8|9B|11B|16B

Output

 

Add a Comment