ProgrammingModerateTCS NQT · Infosys

What does printf("%d", 6 % 4 * 2) print?

  1. A. 3
  2. B. 1
  3. C. 4
  4. D. 12

Correct answer: C. 4

% and * have the same precedence and bind left to right, so the expression is (6 % 4) * 2 = 2 * 2 = 4.

More C Programming questions

Exams that ask this topic