Question: Problem B: Guessing a Random Number The problem here is to guess what number a computer has in mind! You will write a program that

Problem B: Guessing a Random Number The problem here is to guess what number a computer has in mind! You will write a program that randomly generates an integer between 0 and 99, inclusive. The program prompts the user to enter a number continuously until the number entered by user matches the random number generated. For each input, the computer tells whether the input is too low or too high, so that user can make next guess intelligently. Keep track of number of guesses made until the correct answer is given. Program should quit with an appropriate message if the user exceeds a specific number of tries (say, for example: 10 tries), when the user keeps giving wrong guesses, perhaps deliberately! Here is a sample run: Computer has generated a magic number between 0 and 99. You have to guess what it is in minimum number of tries. Enter your Guess: Guess 1 is too high Enter your Guess Guess 2 is too low Enter your Guess Guess 3 is too high Enter your Guess Bingo!! Yes, the correct answer is 39. You guessed it in 4 tries! 50 25 42 39
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
