diff --git a/Mathematics/fibonacci/cpp/fibonacciUsingRecursion.cpp b/Mathematics/fibonacci/cpp/fibonacciUsingRecursion.cpp new file mode 100644 index 000000000..c14ee9ee1 --- /dev/null +++ b/Mathematics/fibonacci/cpp/fibonacciUsingRecursion.cpp @@ -0,0 +1,26 @@ +/* +Problem Statement: +Find nth term in fibonacci series using recursion +*/ + +#include +using namespace std; + +int fibonacci(int n) { + + //base case + if (n == 0 or n == 1) { + return n; + } + + return (fibonacci(n - 1) + fibonacci(n - 2)); +} + + +int main() { + + int n; cin >> n; + cout << fibonacci(n); + + return 0; +} \ No newline at end of file