0
Not working, any idea why ? I have also initialized the variables, still doesn't work
Well, suppose that a cashier owes a customer some change and in that cashierâs drawer are quarters (25Âą), dimes (10Âą), nickels (5Âą), and pennies (1Âą). The problem to be solved is to decide which coins and how many of each to hand to the customer if some customer is owed 41Âą, the biggest first bite that can be taken is 25Âą 41 - 25 = 16 another 25Âą bite would be too big cashier would move on to a bite of size 10Âą, leaving him or her with a 6Âą problem At that point the cashier calls for one 5Âą bite followed by one 1Âą bite https://code.sololearn.com/c0SEp7ZoPCe2/?ref=app https://code.sololearn.com/c0SEp7ZoPCe2/?ref=app
2 Réponses
+ 7
I would use integers instead of floats. int quarter = 25 instead of float quarter = 0.25. The reason is that when you calculate with floats, there's quite a chance that the result will never be exactly 0 because of rounding errors/lack of precision.
+ 1
Thank you