ProgrammingModerate

int a[4] = {4, 3, 2, 1}; int s = 0; for (int i = 0; i < 4; i++) s = s * 10 + a[i]; printf("%d", s); What is printed?

  1. A. 1234
  2. B. 4321
  3. C. 10
  4. D. 4

Correct answer: B. 4321

Each step shifts the running number one digit left and adds the next element, so the digits appear in array order: 4321.

More C Programming questions

Exams that ask this topic