Question: Overall its almost correct however, it is not adjusting the range and I have no clue why, HELP PLEASE! #include #include #include int main() {

Overall its almost correct however, it is not adjusting the range and I have no clue why, HELP PLEASE!

#include #include #include

int main() { int number; int low=1; int high=50; char correctness; char proximity[1]; int tries=1; int guess=(low+high)/2; printf("Enter an integer number between 1 and 50:"); scanf("%d", &number); printf("Is your number: %d? y=yes n=no ", guess); scanf("%s", &correctness); if (correctness=='y') { printf("Your number is %d. It took %d try to guess", guess, tries); } else { while(correctness=='n') { tries++; printf("Too high or too low? h=high, l=low "); scanf("%s", &proximity); if (proximity!='h') { low=guess; guess=(low+high)/2; } else { high=guess; guess=(low+high)/2; } printf("Is your number: %d? y=yes n=no ", guess); scanf("%s", &correctness); } printf("Your number is %d. It took %d tries to guess.", guess, tries); } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!