ProgrammingModerate

int a = 5, b = 2; printf("%d %d", a / b, a % b); What is printed?

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

Correct answer: B. 2 1

Integer division gives 2 and the remainder is 1, because 2 x 2 + 1 = 5.

More C Programming questions

Exams that ask this topic