question archive The following algorithm is designed to print the beginning of what is known as the Fibonacci sequence

The following algorithm is designed to print the beginning of what is known as the Fibonacci sequence

Subject:Computer SciencePrice:2.89 Bought3

The following algorithm is designed to print the beginning of what is known as the Fibonacci sequence. Identify the body of the loop. Where is the initialization step for the loop control? The modification step? The test step? What list of numbers is produced?
Last ← 0;
Current ← 1;
while (Current < 100) do
(print the value assigned to Current;
Temp ← Last;
Last ← Current; and
Current ← Last + Temp)

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

 

Where is the initialization step for the loop control?

Current ← 1;

 

The modification step?

Current ← Last + Temp

 

The test step?

while (Current

 

What list of numbers is produced?

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89