Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions