making-change

 avatar
unknown
python
2 years ago
561 B
4
Indexable
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)
Editor is loading...
Leave a Comment