Created
January 11, 2019 17:00
-
-
Save parzibyte/f1abc2cd30698c7f217e0ef1e66b1e43 to your computer and use it in GitHub Desktop.
Factorial recursivo created by parzibyte - https://repl.it/@parzibyte/Factorial-recursivo
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
=begin | |
Programa en Ruby que calcula el factorial | |
de un número de manera recursiva | |
@author parzibyte | |
=end | |
def factorial(numero) | |
if numero <= 1 | |
1 | |
else | |
numero * factorial(numero - 1) | |
end | |
end | |
50.times do |numero| | |
puts "El factorial de #{numero} es #{factorial numero}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment