🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C Data Types and Operators: all 10 questions

Quiz: C Data Types and Operators · Question 10 of 10

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    printf("%d %d\n", -7 / 2, -7 % 2);
    return 0;
}
  1. A.-4 1
  2. B.-3 -1
  3. C.-3 1
  4. D.-4 -1
Answer & explanation

Correct answer: -3 -1

Integer division truncates toward zero (-3.5 becomes -3), and the remainder takes the sign of the left operand.

Can you get the rest right without peeking?

Take the timed Quiz: C Data Types and Operators quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →