Kizspy | Question: 50
(Choose 1 answer)
Consider a 3x3 matrix mat as shown below. The code snippet is executed to calculate a value named sum.Which of the following options correctly describes the value of the sum after executing the code snippet?
int sum = 0;for (int i = 0; i < 3; i++)sum += matrix[i][i];
A. The sum of diagonal elements in the matrix
B. The sum of all elements in the matrix
C. The sum of non-diagonal elements in the matrix
D. The sum of elements below the main diagonal in the matrix