Skip to the task
Layout
Back to classic view

You are looking at lesson 2. Your place is still lesson 1, task 1: Algorithm.

CHECKTask 17 of 23 · step 7: Drills: check yourself

What does it print? Casts

Write your answer first, only then open the hint.

printf("%d %d %d\n", (int)7.99, (int)(7.4 + 0.5), (int)(7.6 + 0.5));
Stuck?

7 7 8. (int) cuts the fraction off, it doesn't round: 7.99 becomes 7. Adding 0.5 rounds a positive number: 7.9 → 7, 8.1 → 8.