One using the while statement and the other using the for


Make a program that displays the first 10 Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, 21, 34, and 55). Notice that beginning with the third number in the series, each Fibonacci number is the sum of the prior two numbers. Write two versions of the code: one using the while statement, and the other using the for statement. The Fibonacci numbers should appear twice on the screen.

Solution Preview :

Prepared by a verified Expert
Business Management: One using the while statement and the other using the for
Reference No:- TGS02731363

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)