So, I am trying to build this program, where I am suppose to take an input from a user which is a total amount and an amount which is the paid amount. Now, the balance should be broken down into $10, $5, $1, quarters, dimes and nickles. But the below program/code, tells me the total number of quarters, dimes, and nickles in the balance and not the remaining. For example . If the total amount is 5.76 and paid amount is $15 then it should show, zero $10, one $5, 4 $1, zero $.25, 2 $.10 , zero $.05 and four $.01 .
Please tell me whats wrong in the code here?
The easiest fix is to get the number as a float then multiplying it by 100 then saving it as int.
Also to do it in a loop is something like this