Multiple choice

The output of the following program is main() { int a, b, c; int num[3][4]= {1,2,3,4,5,6,7,8,9,10,11,12}; for(a=0;a<3;++a) { c=999; for(b=0;b <4;++b) if (z[a][b]<c) c=z[a][b]; printf(“ %d”,c); } }

  1. 1 5 9

  2. 4 8 12

  3. 1 4 7 10

  4. 1 3 6 9 12

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The code has multiple errors: it declares 'num' but uses 'z' in the comparison, and uses HTML entities (<) instead of operators. If we assume it meant to use 'num' and proper '<' operators, each iteration finds the minimum value in a row. Row 0 minimum is 1, row 1 minimum is 5, row 2 minimum is 9, so output would be '1 5 9'.