2079 6

BIT102 ยท 2079 ยท 5 marks

Write a program to find the sum of diagonal elements of n*n matrix.

Write a program to find the sum of diagonal elements of n*n matrix. [5]

C ProgrammingChapter 6: Arrays and StringsTwo-dimensional arrays

For an nร—n matrix, there are two diagonals: - Principal (Main) Diagonal: elements where row index == column index โ†’ a[i][i] - Secondary (Anti) Diagonal: elements where row + column = n-1 โ†’ a[i][n-1-i] Note: If an element lies on both diagonals (center of odd-sized matrix), it should be counted on...