Discover the answers you need at Westonci.ca, where experts provide clear and concise information on various topics. Explore thousands of questions and answers from a knowledgeable community of experts ready to help you find solutions. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

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.