Chapter 8

Answers to Chapter 8 Review Questions

1: Which general type of statement would you use to implement each of the following logical descriptions:
  1. If number is greater than 100, write “greater than 100” onscreen; otherwise, write “less than or equal to 100.”

  2. Repeatedly check each letter of a string until no more letters are left in the string.

A1:
  1. The branching statement if-else.

  2. An iteration statement.

2: Suppose that your program contains three variables called rainfall, wind, and temperature, all of type double. For each of the following points, write a few lines of code that implement the described logic (you don't need to write the whole program):
  1. If rainfall is greater than 100, write “Heavy rainfall” onscreen.

  2. If rainfall is greater ...

Get C# Primer Plus 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.