The following program shows the Fibonacci sequence using recursion.
Write a C++ program which prints the Fibonacci sequence or the Fibonacci numbers.Fibonacci sequence is named after Leonardo Fibonacci. Fibonacci numbers starts with the first two numbers 0 and 1, and each subsequent numbers takes as the sum of its previous two numbers.
Ex. 0, 1, 1, 2, 3, 5In mathematical equation, Fibonacci sequence can be represented as:
The first two numbers in the sequence are 0 and 1.
The 3rd number which is 1 is the sum of its previous two numbers - 0 and 1.
The 4th number which is 2 is the sum of its previous two numbers - 1 and 1.
So on and so forth...
Fn = F(n-1) + F(n-2) where F0 = 0, F1 = 1