-
-
Save parzibyte/5f3c903a63537223a49f46f1a56e3efb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://parzibyte.me/blog | |
""" | |
def factorial(numero): | |
if numero <= 0: | |
return 1 | |
factorial = 1 | |
while numero > 0: | |
factorial = factorial * numero | |
numero -= 1 | |
return factorial | |
def factorial_recursivo(numero): | |
if numero <= 1: | |
return 1 | |
return numero * factorial(numero-1) | |
valor = 5 | |
f = factorial(valor) | |
print(f"El factorial de {valor} es {f}") | |
f = factorial(valor) | |
print(f"El factorial (calculado de manera recursiva) de {valor} es {f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment