Skip to content

Instantly share code, notes, and snippets.

@brunopgalvao
Created August 16, 2014 01:37
Show Gist options
  • Save brunopgalvao/15ede99687551b998edc to your computer and use it in GitHub Desktop.
Save brunopgalvao/15ede99687551b998edc to your computer and use it in GitHub Desktop.
When given change how much of each denomination to give back!
def change_due(input)
quarters= (input/25)
dimes=((input%25)/10)
nickles=(((input%25)%10)/5)
pennies=(input%5)
puts "#{quarters} quarters, #{dimes} dimes, #{nickles} nickles, and #{pennies} pennies"
end
change_due(24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment