Chapter 9 Selected Answers

Review Question 4: Use the modulus operator, %.

Review Question 6-b: The answer is 7.

First Try This:
  a is -10
  b is 10
  c is 10
  d is 20

Review Exercise #3:
  // Your name goes here
  #include <iostream.h>
  void main()
  {
    // Print the first 8 powers of two
    cout << "2 raised to the first power is " << 2;
    cout << "2 raised to the second power is " << (2*2);
    cout << "2 raised to the third power is " << (2*2*2);
    cout << "2 raised to the fourth power is " << (2*2*2*2);
    cout << "2 raised to the fifth power is " << (2*2*2*2*2);
    cout << "2 raised to the sixth power is " << (2*2*2*2*2*2);
    cout << "2 raised to the seventh power is " << (2*2*2*2*2*2*2);
    cout << "2 raised to the eighth power is " << (2*2*2*2*2*2*2*2);
   }

