Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
denominations.py
# Calculate denominations in dollars, quarters, dimes and cents from a starting sum (in cents)
print('---------------')
amount = 439
print('Total: ', amount)
dollars =(amount-amount%100)/100
amount -=dollars*100
quarters = (amount-amount%25)/25
amount -= quarters*25
dimes = (amount-amount%5)/5
amount -= dimes*5
cents = amount
print()
print('Dollars: ', int(dollars))
print('Quarters: ', int(quarters))
print('Dimes: ', int(dimes))
print('Cents: ', int(cents))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment