First we should know what fibonacci sequence is:
The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … n where the next number is found by adding up the two numbers before it. Similarly, the 8 is found by adding the two numbers before it 5 and 3, the 13 is found by adding the two numbers before it 8 and 5.
Using recursive function to generate Fibonacci series up to given nth number.
int fibonacci_series(int n)
if (n <= 2)
return fib(n-1) + fib(n-2);