ProgrammingHard

printf("%d %d", 5 / 2, -5 / 2); What is printed in C99?

  1. A. 2 -2
  2. B. 2 -3
  3. C. 2.5 -2.5
  4. D. 3 -3

Correct answer: A. 2 -2

Integer division truncates toward zero, so 5 / 2 = 2 and -5 / 2 = -2.

More C Programming questions

Exams that ask this topic