#include <stdio.h>
int main(){
int MAP[4][4] = {12,11,14,15,
21,22,23,24,
65,55,66,77,
87,98,51,32};
int i, j;
int sum = 0;
for (i=0;i<4;i++){ //行号 i:0~3
for (j=0;j<4;j++){ //列号 j:0~3
if (i == j || (i + j) == 3){ //"||"逻辑运算符的或
sum += MAP[i][j];
}
}
}
printf("sum=%d\n", sum);
return 0;
}
标签:组中,int,矩阵,65,对角线,优化
From: https://www.cnblogs.com/sys2410/p/16755327.html