Multiple choice

What is the output of following 'C' fragment? For(i=1,j=10;i<6;++i,--j) printf(“%d%d”,i,j);

  1. 1 10 2 9 3 8 4 7 5 6

  2. 1 2 3 4 5 10 9 8 7 6

  3. 1 1 1 1 1 9 9 9 9 9

  4. None of above

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

The loop runs for i = 1 to 5. In each iteration, i increments and j decrements. The output prints i and j concatenated: 110, 29, 38, 47, 56.