ProgrammingModerateWipro NLTH · C

What is printed?

What is printed?
printf("%.1f %d", 7 / 2 * 2.0, (int)(7 / 2.0 * 2));
  1. A. 7.0 7
  2. B. 6.0 7
  3. C. 6.0 6
  4. D. 7.0 6

Correct answer: B. 6.0 7

7 / 2 is integer division (3) before the multiplication, giving 6.0; 7 / 2.0 is 3.5, and 3.5 * 2 = 7.

More C Programming questions

Exams that ask this topic