Question: Randomly generate an integer n from the range 1 to 1 0 0 . Prompt the user to guess the integer. After each guess, the

Randomly generate an integer n from the range 1 to 100.
Prompt the user to guess the integer.
After each guess, the program gives a hint:
If the guess is larger than n, then the program prints Too big.
If the guess is smaller than n, then the program prints Too small.
If the user's guess is incorrect, then prompt the user to guess again.
The program keeps track of the number of guesses.
When the user's guess is correct, print Congratulations! You took g guesses. where g is the number of guesses.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!