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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started