Question: Loops & Branching Structures Play a guessing game with the user. Pick any number then write a MATLAB program that will ask the user
Loops & Branching Structures
Play a guessing game with the user. Pick any number then write a MATLAB program that will ask the user to guess which number you had chosen. Create a function called guessanumber under which your program must run. Use a while loop with a nested If branch structure as your program body. As soon as the user had succeeded in choosing the correct number, display the following message,
You have guessed correctly
It took you mathrmf times to guess the number correctly
and abort the program. If the user chose incorrectly, display the following message:
You have guessed incorrectly, try again!
Finish the program with the message OK bye, bye".
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
