Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a while loop. In each iteration generate a random number using rand(1,1). Keep doing that until we get a number between 0.5 and 0.6.
Create a while loop. In each iteration generate a random number using rand(1,1). Keep doing that until we get a number between 0.5 and 0.6. Print out the generated number and number of iterations
Sample Output:
>> random_number
n is 4, number is 0.515766 >> random_number
n is 7, number is 0.509839 >> random_number
n is 14, number is 0.593828
ASAP please and thanks!
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