How can I create currency note count calculator if I have currencies which has decimals and total amount which also has decimals?

31 Views Asked by At

If i have currencies that are in decimals {0.7,0.8,1.4,0.5} and total amount which also has decimals (example: 1279.6) and I tell you that you need to make total within certain number of currency note counts (example: Total has to be 27.6 and available currencies are 0.7,0.8,1.4,0.5 and you have to use 35 counts of total no. of currency notes. what will be the counts of each currency to make up that total?) The answer to that question would be (13 notes of 0.7 currency + 7 notes of 0.8 currency + 6 notes of 1.4 currency + 9 notes of 0.5 currency would total to 27.6 and total currency count is 35 notes (13+7+6+9))? How can I achieve this through mathematical equations?