Chapter 5
30
27 (not 3). (12 + 6)/(2*3) would give 3.
x = 1, y = 1 (integer division)
x = 3 (integer division) and y = 9
6 (reduces to 3 + 3.3)
52
0 (reduces to 0 * 22.0)
13 (reduces to 66.0 / 5 or 13.2, then assigned to int)
Line 0: Should include <stdio.h>.
Line 3: Should end in a semicolon, not a comma.
Line 6: The while statement sets up an infinite loop because the value of i remains 1 and is always less than 30. Presumably we meant to write while(i++ < 8).
Lines 6–8: The indentation implies that we wanted lines 7 and 8 to form a block, but the lack of braces means that the while loop includes only line 7. Braces should be added.
Line 7: Because 1 and i are both integers, the result of the division will be 1 when i is 1, and 0 for all larger values. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access