Pure Programmer
Blue Matrix


Cluster Map

Project: Fibonacci Numbers

You can compute numbers in the [[Fibonacci_number|Fibonacci Sequence]] easily using function recursion. The Fibonacci Sequence is specified by the recurrence relation...

`F_n = F_n-1 + F_n-2` for n > 1
with `F_0` = 1 and `F_1` = 1

Write a [[Recursion_(computer_science)|recursive function] to compute Fibonacci numbers given n. Write a main program to test the function.

Output
$ g++ -std=c++17 Fibonacci1.cpp -o Fibonacci1 -lfmt $ ./Fibonacci1 Fibonacci Sequence 1: 1 2: 2 3: 3 4: 5 5: 8 6: 13 7: 21 8: 34 9: 55 10: 89 11: 144 12: 233 13: 377 14: 610 15: 987 16: 1597 17: 2584 18: 4181 19: 6765 20: 10946

Solution