Answers for "Python fibonacci series (Recursion)"

0

Python fibonacci series (Recursion)

Input:

def Fib(n):
   if n <= 1:
       return n
   else:
       return (Fib(n - 1) + Fib(n - 2))  # function calling itself(recursion)


n = int(input("Enter the Value of n: "))  # take input from the user
print("Fibonacci series :")
for i in range(n):
   print(Fib(i),end = " ")

Output:

Enter the value of n:  8
0 1 1 2 3 5 8 13
Posted by: Guest on February-04-2022

Code answers related to "Python fibonacci series (Recursion)"

Python Answers by Framework

Browse Popular Code Answers by Language