18 Sep 2018
Instructions
-
Before you begin, spend 5 minutes outlining a strategy with other students at your table.
-
Create at least one diagram or flow-chart.
-
-
Please submit your work below (one per person):
Fibonacci Numbers
The Fibonacci numbers make up a famous integer sequence that is found commonly in nature:
-
The first two Fibonacci numbers are 0 and 1.
-
Each number in the sequence is the sum of the previous two numbers.
-
Further details at Wikipedia: Fibonacci numbers
Your Program
Use the above information to create the following C++ program:
-
Ask the user for a (positive) integer.
-
Use a
while()
loop to compute the user-specified quantity of Fibonacci numbers. -
Test your program and verify its output for Fibonacci numbers 0-9.
-
Use your program’s output to compute the difference between:
-
the 24th and 25th Fibonacci numbers.
-
the 25th and 26th Fibonacci numbers.
-