#include int main() { int secretNumber = 200; // Change this to the secret number int minRange = 1; int maxRange = 1000; int guess; char response; printf("Think of a number between %d and %d and wait for me to guess it.\n", minRange, maxRange); printf("After every guess, state whether the guess was too high (h), too low (l), or correct (c) to your number.\n\n"); int attempts = 0; do { guess = (minRange + maxRange) / 2; printf("Guess %2d is: %2d. The score for which is (h,l,c): ", ++attempts, guess); scanf(" %c", &response); if (response == 'h') { maxRange = guess - 1; } else if (response == 'l') { minRange = guess + 1; } else if (response == 'c') { printf("\nIt took %d attempts.\n", attempts); return 0; } else { printf("Invalid input. Please enter 'h', 'l', or 'c'.\n"); } } while (1); return 0; }