← 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;
}
- A.-4 1
- B.-3 -1
- C.-3 1
- 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 →