Advertisement
XeBuZer0

Fibonacci's secuence in Python (iterative)

Dec 22nd, 2019
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. # Este programa en python calcula el n-ésimo término de la suceśión de Fibonacci
  2. # Licenciado bajo GNU's Not Unix General Public Licence (GNU GPL) versión 3
  3. def Fibo(x):
  4.     acum = a = 0
  5.     b = 1
  6.     for i in range(1,abs(x)):
  7.         acum = a + b
  8.         a = b
  9.         b = acum
  10.     return acum
  11. print(Fibo(int(input("Ingrese un número natural:   "))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement