Question
i need a flow chart for this code in c Please give me a correct answer not on a software that generate it #include #include
i need a flow chart for this code in c Please give me a correct answer not on a software that generate it
#include
void startGuessTheNumberGame(); // define function
int main() { startGuessTheNumberGame(); } void startGuessTheNumberGame() // define function { int secretNumber ; int low = 1 ; int high = 10000 ; int menu2 ; int counter = 1 ; int Guess ; printf("Enter A Secret Number Between 1 and 10000 : "); scanf("%d", &secretNumber);
while(low <= high) { Guess = low + (high - low) / 2; printf(" My Guess is : %d", Guess) ; printf(" Please Choose One Of The Following 3 Options : 1.My Guess Is Correct. 2.The secret Number IS Larger Than %d", Guess) ; // print menu printf(". 3.2.The secret Number IS Smaller Than %d", Guess);
printf(" "); scanf("%d",&menu2); switch(menu2) { case 1 : printf("we take to find their secret number %d", counter); break;
case 2 : low = Guess + 1 ; break; case 3 : high = Guess - 1; break;
default : printf("your Choose is Invalid "); break ; }
if(menu2 == 1) // to exit the program { break ; // Exit the program } counter++;
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started