Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 5 - Algorithms - Chapter Review Problems - Page 265: 22

Answer

See explanation

Work Step by Step

The body of the loop is the set of statements inside the loop, in the given code they are - $print(Current)$ $Temp = Last$ $Last = Current$ $Current = Last + Temp$ Initialization step is the step in which we initialize the loop variable, in the given code it is the statement - $Current = 1$ Modification step is the step in which we modify the loop variable, in the given code it is the statement - $Current = Last + Temp$ Test step is the step in which the termination condition is checked, in the given code it is the statement - $while (Current < 100):$ The code will produce following sequence : 1 1 2 3 5 8 13 21 34 55 89
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.