The United States dollar (USD) is the official currency of the United States and its territories per the Coinage Act of 1792. One dollar is divided into 100 cents (symbol: ยข). The names of the Official United States coins are:
name | value (in cents) | portrait | reverse motf |
---|---|---|---|
cent (or penny) | 1 | Abraham Lincoln1 | Union Shield |
nickel | 5 | Thomas Jefferson2 | Monticello3 |
dime | 10 | Franklin Delano Roosevelt4 | olive branch, torch, oak branch |
quarter | 25 | George Washington5 | eagle |
dollar | 100 | Sacagawea6 with her child | Bald eagle in flight |
The code snippet below assigns a value of money (in cents) to the variable amount
. Determine the maximum number of dollars that fit in the amount, then the maximum number of quarters that fit in the remainder after you subtract the dollars, then the maximum number of dimes that fit in the remainder after you subtract the dollars and quarters, and so on for nickels and pennies. The result is that you express the amount as the minimum number of coins needed.
Write the minimum number of coins needed to pay the given amount of money (in cents). Use the following output format:
Dollars: ???
Quarters: ???
Dimes: ???
Nickels: ???
Cents: ???