1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 15:48:42 +00:00
202401-programming-assignments/【实践课外】10.函数1/6-4 其右上三角(含主对角线)元素之和。.c

12 lines
176 B
C

int fun(int a[3][3]) {
int res = 0;
for (int i = 0; i < 3; i++) {
for (int j = i; j < 3; j++) {
res += a[i][j];
}
}
return res;
}