Consider the following C program carefully. What will be printed on the screen when this program is compiled and executed?
#include <stdio.h>
int main() {
int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
int i, j, s = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
if ((i + j) % 2 == 0)
s += m[i][j];
printf("%d", s);
return 0;
}9
21
12
6
The verified answer and full solution are one login away
Every answer here is machine verified, with a step-by-step solution that teaches the method. Your login also unlocks a 7-question mock preview in the real exam interface.
Log in to see the answerMore c output questions