Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def GenerateFibonaci(x):
  2.  
  3.  if(x == 0):
  4.   return 0
  5.  
  6.  elif(x == 1):
  7.   return 1
  8.  
  9.  else:
  10.   return GenerateFibonaci(x-1) + GenerateFibonaci(x-2)
  11.  
  12. #main
  13.  
  14. x = int(input("Enter the term till which you wnat to generate fibonacci sequence: "))
  15.  
  16. for i in range(x):
  17.  print(GenerateFibonaci(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement