Next ❯ ❮ Previous

Python program to generate Fibonacci series using recursion


FibonacciExample.py

def fibonacci(n):
  if n<=1:
    return n
  else:
    return (fibonacci(n-1)+fibonacci(n-2))

terms=7
if terms<=0:
  print("Please enter a positive integer value")
else:
  print("Fibonacci Series is:")
  for k in range(terms):
    print(fibonacci(k))
Output
Fibonacci Series is:
0
1
1
2
3
5
8

Next ❯ ❮ Previous

Follow Us




  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved