Write a recursive function for Fibonacci Series, which takes number of terms as input and prints the series terms accordingly.
#include <iostream>
using namespace std;
int Fibonacci_Series(int number)
{
if((number==1)||(number==0))
{
return(number);
}
else
{
return(Fibonacci_Series(number-1)+Fibonacci_Series(number-2));
}
}
int main()
{
int number , i=0;
cout << "Enter the number of terms of series = ";
cin >> number;
cout << "\nFibonacci_Series = ";
while(i < number)
{
cout << " " << Fibonacci_Series(i);
i++;
}
return 0;
}