Chapter 7

  1. True: b.

    1. number >= 1 && number < 9

    2. ch != 'q' && ch != 'k'

    3. (number >= 1 && number <= 9) && number != 5

    4. (number >= 1 && number <= 9) or else number < 1 || number > 9

  2. Line 5: Should be scanf("%d %d", &weight, &height);. Don't forget those &s for scanf(). Also, this line should be preceded by a line prompting input.

    Line 9: What is meant is (height < 72 && height > 64). However, the first part of the expression is unnecessary because height must be less than 72 for the else if to be reached in the first place. Therefore, a simple (height > 64) will serve.

    Line 11: The condition is redundant; the second subexpression (weight not less than or equal to 300) means the same as the first. A simple (weight > 300) is all that is needed. But there is ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.