Sum of Digionals of matrix | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Sum of Digionals of matrix

29th Apr 2024, 1:45 PM
Harshdeep Makker
1 Answer
+ 2
There might be two diagonal sum of a matrix, the sum of the main diagonal elements (from top-left to bottom-right and the the sum of the other diagonal elements of same matrix (from top-right to bottom-left). Here I calculate the sum of both diagonals of 3 x 3 matrix. One code is predefined matrix in it and the other taking input from user and calculate the sum. But if this is a homework question, definitely you should attached your attempts with the question and we will resolve it. But I already did code one same problem, so easy for me to share. But for the next time be sure you attached your effort/codes with the question. https://sololearn.com/compiler-playground/ch98Vekbf41Z/?ref=app https://sololearn.com/compiler-playground/c61mx6e51wL0/?ref=app
29th Apr 2024, 2:33 PM
`нттየ⁴⁰⁶
`нттየ⁴⁰⁶ - avatar