218k views
1 vote
Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies.

User Rechie
by
4.4k points

1 Answer

0 votes

Answer:

a=input("Amount in pennies")

b=int(a)

dollars=0

dimes= 0

quarters=0

nickels=0

pennies = 0

dollars = int(b/100)

b= b- dollars *100

quarters=int(b/25)

b=b-quarters*25

dimes = int(b/10)

b = b -dimes*10

nickels=int(b/5)

b=b - nickels * 5

pennies = b

print(dollars)

print(dimes)

print(nickels)

print(pennies)

Step-by-step explanation:

The required program is in answer section. Note, the amount is entered in pennies.

User Panjan
by
4.2k points