Can someone please help me, as far as I think this code should give back the number of coins needed but it is not working.
1 Answer
The problem is that the code uses do/while loops when it should have used while loops.
A do/while loop will ALWAYS run at least once. That means that it will add 4 coins and subtract at least 25 cents, 10 cents, 5 cents and 1 cent no matter what the amount is.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)