Question PRG-C-0051
MediumWhat is the output of this program?
#include <stdio.h>
int main() {
int a[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
int s = 0;
for (int i = 0; i < 3; i++)
s += a[i][2 - i];
printf("%d", s);
return 0;
}
- A.
15
- B.
12
- C.
Sign up free to see the answer and a step-by-step explanation.