O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required