Click here to Skip to main content
16,022,846 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Posted

1 solution

Well, think about it logically. You start with an amount, and you need to split it down. You have only certain denominations available, right ? So, if you have $53.32, what's the highest denomination that goes into that ? If it's $20, then you would have $33.32 left. So, what's the highest that goes into that ? $20, so you now have $13.32. That's the sort of process your code will go through, subtracting whatever amount represents the biggest note or coin that can be put on the pile.

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900