ProgrammingModerate

printf("%d %d", 7 / 2 * 2, 7 / (2 * 2)); What is printed?

  1. A. 7 1
  2. B. 6 2
  3. C. 7 2
  4. D. 6 1

Correct answer: D. 6 1

Division truncates. 7 / 2 = 3 and 3 * 2 = 6. The second expression is 7 / 4 = 1.

More C Programming questions

Exams that ask this topic