Advertisement
jumboframe

Fibonacci

Jun 7th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. n = int(input())
  2.  
  3. first = 1
  4. second = 1
  5.  
  6. if (n ==1 ) or (n == 0 ):
  7.     print (1)
  8.     exit(0)
  9.  
  10. for i  in range (2, n+1):
  11.     f = first + second
  12.     first = second
  13.     second = f
  14.  
  15. print (f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement