From 8fb4df5367b5c03d2851532063f6fa781fe2f980 Mon Sep 17 00:00:00 2001 From: Purvesh Makode Date: Tue, 2 Oct 2018 18:14:53 +0530 Subject: [PATCH] Add Fibonacci Series Using Recursion --- Maths/fibonacciSeries.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Maths/fibonacciSeries.py diff --git a/Maths/fibonacciSeries.py b/Maths/fibonacciSeries.py new file mode 100644 index 000000000..cf025b07d --- /dev/null +++ b/Maths/fibonacciSeries.py @@ -0,0 +1,16 @@ +# Fibonacci Sequence Using Recursion + +def recur_fibo(n): + if n <= 1: + return n + else: + return(recur_fibo(n-1) + recur_fibo(n-2)) + +limit = int(input("How many terms to include in fionacci series:")) + +if limit <= 0: + print("Plese enter a positive integer") +else: + print("Fibonacci series:") + for i in range(limit): + print(recur_fibo(i))