Skip to content

Commit da3af60

Browse files
authoredOct 2, 2018
Merge pull request TheAlgorithms#393 from purveshmakode24/master
Add Fibonacci Series Using Recursion
2 parents 0e76ee9 + 8fb4df5 commit da3af60

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎Maths/fibonacciSeries.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Fibonacci Sequence Using Recursion
2+
3+
def recur_fibo(n):
4+
if n <= 1:
5+
return n
6+
else:
7+
return(recur_fibo(n-1) + recur_fibo(n-2))
8+
9+
limit = int(input("How many terms to include in fionacci series:"))
10+
11+
if limit <= 0:
12+
print("Plese enter a positive integer")
13+
else:
14+
print("Fibonacci series:")
15+
for i in range(limit):
16+
print(recur_fibo(i))

0 commit comments

Comments
 (0)