Description
Write a function that sums all the integers in the major diagona in a matrix of integers.
The matrix is 4 * 4. Using the flowing function header:
int sumMajorDiagona(int matrix[4][4])
Hint
You should submit the implementation of the function but do not submit the main() function.
Problem Source: 程序设计I Chapter6 Arrays
Source.h
int sumMajorDiagona(int matrix[4][4]);
// Date:2020/4/24
// Author:xiezhg5
int sumMajorDiagona(int matrix[4][4])
{
int i,sum=0;
for(i=0;i<4;i++)
sum=sum+matrix[i][i]; //计算主对角线元素和
return sum;
}