Skip to content

Commit

Permalink
Merge pull request #95 from AKASHGUPTA04/main
Browse files Browse the repository at this point in the history
Create fibonnaci_recursion.cpp
  • Loading branch information
zainanizar authored Oct 5, 2021
2 parents fc064b5 + b7ffbf5 commit fbf22e9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fibonnaci_recursion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
using namespace std;
int fibo(int x)
{
if((x==1)||(x==0))
{
return(x);
}
else
{
return(fibo(x-1)+fibo(x-2));
}
}
int main() {
int x , i;
cout << "Enter the number of terms of series to be printed: ";
cin >> x;
cout << "\n Fibonnaci Series is: ";
for(i=0;i < x;i++)
{
cout << " " << fibo(i);
}
return 0;
}

0 comments on commit fbf22e9

Please sign in to comment.