University of Iowa Computer Science Department

Quiz 03


1. Define an integer variable x and assign it a value. Write a switch statement that prints the string "Bingo" if the value in x is either      1,  2, or 4, prints the string "Sorry" if the value in x is 3, 5, or 6, and prints the string "Your luck just ran out" for any other value in x.

2. Write a do/while statement that prompts the user for an integer between 1 and 4, inclusive. If the user does not input a value in that range, your program should re-prompt the user.

CLAS CRA ACM | ©2005 The University of Iowa | Modified: February 18, 2005, 08:19:43.