Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Fibonacci
- #fib = 1,1,2,3,5,8,...
- def Fibonacci(num):
- x1=1;
- x2=1;
- if num == 0:
- print('Zero arguments')
- else:
- i=0
- while i< num:
- if i < 2:
- print(x1)
- else:
- x1=x1+x2
- x2=x1-x2
- print(x1)
- i+=1
- num = int(input("How many Fibonacci numbers to generate?:"))
- Fibonacci(num)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement