Exam 2 Study Guide

Here are some programs for you to write for practice:

  1. Write a program that inputs a number and prints out if it is outside of the range of 1 to 100
  2. Modify the first program so that it prints out a specific error message of too low or too high
  3. Modify the first program to repeatedly ask for a new value while the number is outside of the range of 1 to 100
  4. Modify the third program to repeatedly ask for a new value while the number is outside of the range of 1 to 100 and print out a specific message of too high or too low
  5. Create a new program that uses a for loop to give the user the numbers from 1 to 100 that are evenly divisible by a value that the user inputs.
    A solution
  6. Create a program that generates the following using nested for loops:
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1
    

    A solution
  7. Create a program that repeatedly provides the user with three options and simply prints out which option was entered . Use a switch and do loop.
    A solution