Analyze the following algorithm where the work unit is the output statement. (Hint: One

Chapter 3, Problem 6

(choose chapter or problem)

Get Unlimited Answers
QUESTION:

Analyze the following algorithm where the work unit is the output statement. (Hint: One of the exercises in Section 2.2 might be helpful). integer i real d, x; for i = 1 to n do d = 1.0/i; x = i; while x > 0 do write x x = x d; end while end for

Questions & Answers

QUESTION:

Analyze the following algorithm where the work unit is the output statement. (Hint: One of the exercises in Section 2.2 might be helpful). integer i real d, x; for i = 1 to n do d = 1.0/i; x = i; while x > 0 do write x x = x d; end while end for

ANSWER:

Step 1 of 2

The algorithm took 3 variables  

The first loop is for loop which starts from 1 to n then start calculating  

 

So

        

And  and   is continuously changing the value as till 

Add to cart


Study Tools You Might Need

Not The Solution You Need? Search for Your Answer Here:

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back