ProgrammingModerateTCS NQT · Infosys

What does printf("%d", 10 / 3 * 3 == 10) print?

  1. A. 0
  2. B. 1
  3. C. 3
  4. D. 10

Correct answer: A. 0

10 / 3 truncates to 3, so the left side is 9 and 9 == 10 is false. Integer division loses the remainder before the multiplication.

More C Programming questions

Exams that ask this topic