Question: Problem 2: (5 marks) Imagine you are running a store, and you have access to cash in different denominations, 20, 10, 5 and 1 for
Problem 2: (5 marks) Imagine you are running a store, and you have access to cash in different denominations, 20, 10, 5 and 1 for the dollars; quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent) for the rest. Write a code that receives an amount of money as input and says how to build that number using your cash and using the least amount of bills/coins as possible. (Hint: Integer division and modulus are very useful here) Example Input: Tell me how much money: 73.17 Output Twenties= 3 Tens= 1 Fives= 0 Dollars= 3 Quarters= 0 Dimes= 1 Nickels= 1 Pennies= 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
