Skip to content

Instantly share code, notes, and snippets.

@StephenFiser
Created May 27, 2014 16:03
Show Gist options
  • Select an option

  • Save StephenFiser/529f9c0ab116bdd8f086 to your computer and use it in GitHub Desktop.

Select an option

Save StephenFiser/529f9c0ab116bdd8f086 to your computer and use it in GitHub Desktop.
p "Enter a number: "
num1 = gets.chomp.to_i
p "Enter an exponent: "
num2 = gets.chomp.to_i
def exponent(number, exp)
number ** exp
end
answer = exponent(num1, num2)
p "#{num1} to the power #{num2} equals #{answer}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment