At Westonci.ca, we connect you with the answers you need, thanks to our active and informed community. Get quick and reliable solutions to your questions from a community of seasoned experts on our user-friendly platform. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.

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.