To print the sum of upper right diagonal elements of a matrix of n*n order | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

To print the sum of upper right diagonal elements of a matrix of n*n order

for ex; 00 01 02 10 11 12 20 21 22 then the upper right diagonal elements are 01,02,12 .

15th Jul 2017, 6:58 PM
shakti
1 Answer
+ 3
With square matrix it's really simple: iterate over only one loop, and sum the items [i][i]...
15th Jul 2017, 7:19 PM
visph
visph - avatar