Solution Found!
Analyze the following algorithm where the work unit is the output statement. (Hint: One
Chapter 3, Problem 6(choose chapter or problem)
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