Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 14, 2019 22:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Elevar números en Ruby created by parzibyte - https://repl.it/@parzibyte/Elevar-numeros-en-Ruby
puts "Voy a elevar el número que me digas a la potencia que me indiques
Escribe el número:"
numero = gets.chomp.to_f
puts "Escribe la potencia:"
potencia = gets.chomp.to_f
# Para elevar, usamos ** como en Python y JavaScript
elevado = numero ** potencia
puts "#{numero} ^ #{potencia} = #{elevado}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment