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

20th May 2019, 1:57 PM
kinan hamwi
kinan hamwi - avatar
2 odpowiedzi
+ 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.
20th May 2019, 2:21 PM
Anna
Anna - avatar
+ 1
Thank you
20th May 2019, 3:01 PM
kinan hamwi
kinan hamwi - avatar