Skip to content

Instantly share code, notes, and snippets.

@manojnaidu619
Last active July 1, 2019 17:28
Show Gist options
  • Save manojnaidu619/770c590515e2c3127ca8be803a02a238 to your computer and use it in GitHub Desktop.
Save manojnaidu619/770c590515e2c3127ca8be803a02a238 to your computer and use it in GitHub Desktop.
Fibonacci using Recursion in CPP
#include <iostream>
using namespace std;
int fib(int n){
if(n<=1){return n;}else{
return fib(n-2) + fib(n-1);
}
}
int main(){
int n = 0;
cout << fib(n) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment