Computer Science, asked by gayatrigangurde1999, 9 months ago

Write a program to find the nth term in the Fibonacci series using recursion.

Answers

Answered by Yamini1999
0

Answer:

#include<iostream>

using namespace std;

int fib(int n)

{

if((n==1)||(n==0))

{

return(n);

}

else

{

return(fib(n-1)+fib(n-2));

}

}

int main()

{

int n,i=0;

cout<<"number of terms are:";

cin>>n;

cout<<"\nFibonacci Series\n";

while(i<n)

{

cout<<" "<<fib(i);

i++;

}

return 0;

}

Similar questions