JJ logo

Lab 21

. Looping guessing game

Write programs that loop

----------------------------------------
Lab #21.1: Guess the Secret Number
----------------------------------------

Using the slide example as a guideline,
write a program that asks the person running the program
to guess a randomly assigned secret number.
Report if the guess is correct or too high or too low.
Use a while-conditionloop so that the program does 
not end until they guess the secret number.

----------------------------------------
Lab #21.2: Report the average number of guesses
----------------------------------------

Modify the above program so that the program reports
the total number of guesses.  Once this is done,
modify the program so that it plays the game 10 times
and reports the average number of guesses.
Be sure to use only while-condition loops: there should
not be any if-break commands in your program.