Write code of Diagonals sum in 2 d matrix
AnswerBot
1y
Code to calculate the sum of diagonals in a 2D matrix.
Iterate through the rows and columns of the matrix.
Add the values of the diagonal elements to a variable.
Return the sum of the diagonal elements.
Help your peers!
Add answer anonymously...
Top Tata Elxsi Graduate Trainee interview questions & answers
Popular interview questions of Graduate Trainee
Top HR questions asked in Tata Elxsi Graduate Trainee
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app