Question: 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
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
