IDNLearn.com: Where your questions are met with thoughtful and precise answers. Discover prompt and accurate answers from our community of experienced professionals.

Ask the user to think of a number between zero and one hundred. Your goal is to guess the number in as few guesses as possible. The user will inform you if you guessed too high, low or correct. Start by always guessing the middle number 50. If the user informs you it’s too low, then try 75. If 50 was too high, then try 25. Always guess the middle of the range of numbers left. In doing so, the range of numbers will be cut in half after each guess. If done correctly, no more than 7 guesses are needed. Print out “you cheated” if you reach 7 guesses and are still wrong.