making-change

mail@pastecode.io avatar
unknown
python
7 months ago
561 B
1
Indexable
Never
mount = int(input("Enter the amount in cents: "))

# Calculate the number of each coin denomination needed
toonies = amount // 200
amount %= 200

loonies = amount // 100
amount %= 100

quarters = amount // 25
amount %= 25

dimes = amount // 10
amount %= 10

nickels = amount // 5
amount %= 5

pennies = amount // 1
amount %= 1

# Display the number of each coin denomination
print("Loonies:", loonies)
print("Toonies:", toonies)
print("Quarters:", quarters)
print("Dimes:", dimes)
print("Nickels:", nickels)
print("Pennies:", pennies)
Leave a Comment