3_Answers_5_1_bool-1

3_Answers_5_1_bool-1 - CIS 15AG 1 Answers Chapter 5:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 15AG Answers Chapter 5: Selection – Making Decisions 1. Simplify: a. !(a == sqrt( b * b + c * c)) a != sqrt( b * b + c * c) b. !(length >= width + 20) length < width + 20 c. !(cDay < bDay) cDay >= bDay d. !(cMonth != bMonth) cMonth == bMonth 2. Write a C logical expression that evaluates to true if the integer variable score is within the range [80, 90). What's wrong with the following expression? How would you correct it? 8 0 <= score < 90 ( 80 <= score score < 90 ) 80 <= score score < 90 () not needed since the relational operators: < <= > >= == != have a higher precedence than and || 3. Write a logical expression that checks if today is your birthday. int cMonth = 2; // current month int bMonth = 2; // birth month int cDay = 29; int bDay = 29; cMonth == bMonth cDay == bDay 4. Write a C logical expression that evaluates to true if the integer variable score is outside the range [80, 90). score
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

3_Answers_5_1_bool-1 - CIS 15AG 1 Answers Chapter 5:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online