Question: Write a iterative function that finds the n-th integer of the Fibonacci sequence(using C++ and a function). Then build a minimal program (main function) to

Write a iterative function that finds the n-th integer of the Fibonacci sequence(using C++ and a function). Then build a minimal program (main function) to test it. That is, write the fib() solution as a separate function and call it in your main() function to test it. For reference see Fibonacci number.

INPUT

5 

OUTPUT

(0, 2) (1, 3) (2, 5) 5

INPUT:

7 

OUTPUT:

(0, 2) (1, 3) (2, 5) (3, 8) (4, 13) 13

INPUT:

20 

OUTPUT:

(0, 2) (1, 3) (2, 5) (3, 8) (4, 13) (5, 21) (6, 34) (7, 55) (8, 89) (9, 144) (10, 233) (11, 377) (12, 610) (13, 987) (14, 1597) (15, 2584) (16, 4181) (17, 6765) 6765

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!