二维数组的对角线之上的和
#include<stdio.h>
int main() {
int j, s = 0;
int a[3][3] = { 1,2,3,4,5,6,7,8,9 };
for (int i = 0; i<3; i++)
{
for (j = i + 1; j<3; j++)
{
s += a[i][j];
}
}printf("%d", s);
}
二维数组的对角线之上的和
#include<stdio.h>
int main() {
int j, s = 0;
int a[3][3] = { 1,2,3,4,5,6,7,8,9 };
for (int i = 0; i<3; i++)
{
for (j = i + 1; j<3; j++)
{
s += a[i][j];
}
}printf("%d", s);
}