engineering computer science MCQ #2151

What is the output of `printf('%d %d', 5/2, -5/2)`?

engineering computer science MCQ #2151

  1. Question 1

    Q1. What is the output of `printf('%d %d', 5/2, -5/2)`?

    • A) 2 -2
    • B) 2 -3
    • C) 3 -2
    • D) 3 -3

    Answer: 2 -3

    Explanation: Integer division truncates towards zero, so 5/2 = 2 and -5/2 = -2.