From 9a4496e252785a37e582f8d788845100443e13de Mon Sep 17 00:00:00 2001 From: deepak7336 <70963318+deepak7336@users.noreply.github.com> Date: Sat, 1 Oct 2022 00:58:06 +0530 Subject: [PATCH] Create Fibonacci_numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….. In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation --- C++/Fibonacci_numbers | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 C++/Fibonacci_numbers diff --git a/C++/Fibonacci_numbers b/C++/Fibonacci_numbers new file mode 100644 index 0000000..12ba5a0 --- /dev/null +++ b/C++/Fibonacci_numbers @@ -0,0 +1,20 @@ +// Fibonacci Series using Recursion +#include +using namespace std; + +int fib(int n) +{ + if (n <= 1) + return n; + return fib(n - 1) + fib(n - 2); +} + +int main() +{ + int n = 9; + cout << fib(n); + getchar(); + return 0; +} + +