Created
November 5, 2016 21:51
-
-
Save versluis/3c1b06e200966438348c7e62a0fa8ae0 to your computer and use it in GitHub Desktop.
denominations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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