Question: How do I write this on matlab?? a) Create a string variable and assign to it your favorite color b) Write Matlab code that prompts
a) Create a string variable and assign to it your favorite color b) Write Matlab code that prompts the user to guess your favorite color. After the user has had 3 attempts, the program displays the message "Incorrect. You run out of chances!" and stops. For example, let's assume you set your favorite color as blue, when you run your code the output could look like this: >>Guess my favorite Color: red Incorrect. Try again >> Guess my favorite Color: yellow Incorrect. Try again >> Guess my favorite Color: green Incorrect. You run out of chances! Another scenario: >> Guess my favorite Color: blue Your guess is correct. Bravo
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
