Question: Write a C program that does a binary search to guess a number a user picks between 1 and 50. The user will tell the

Write a C program that does a binary search to guess a number a user picks between 1 and 50. The user will tell the computer if the guess is correct. If the guess is not correct, the user will tell the computer if the guess is too high or too low. The computer will continue guessing until the number is found. The computer will tell the user their number and how many attempts it took to find it. Example console output is shown below. Enter an integer number between 1 and 50: 35 Is your number: 25? y yesn no Too high or Too low? h high, low s your number: 37? y - yes n -no oo high or Too low? h = high, 1 Is your number: 31? y = yes n- no low oo high or Too low? h - high, 1-low Is your number: 34? y yes n no oo high or Too low? h high, 1 low s your number: ,35? y - yes n no our number is 35. It took 5 attempt(s) to guess

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 Databases Questions!