Question: Write a script that will generate a random integer 'n' in the range -100 to 100 then attempt to guess what the value of n

 Write a script that will generate a random integer 'n' in

Write a script that will generate a random integer 'n' in the range -100 to 100 then attempt to "guess" what the value of n is by repeatedly generating a new random integer in the same range until the two match. The script should then print how many tries it took to guess "n" correctly, as well as the value of n. For example: > guess_n It took 15 tries to guess n-27 guess_n It took 97 tries to guess n =-41 Your Script C Reset MATLAB Documenta 1% generate a random value for n 4% repeatedly attempt to "guess" n. Store your guesses in the variable "guess" guess = 6 71% print the results

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!