Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 11, 2019 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/f1abc2cd30698c7f217e0ef1e66b1e43 to your computer and use it in GitHub Desktop.
Save parzibyte/f1abc2cd30698c7f217e0ef1e66b1e43 to your computer and use it in GitHub Desktop.
Factorial recursivo created by parzibyte - https://repl.it/@parzibyte/Factorial-recursivo
=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