C#C
C#3y ago
jadders

❔ Coin sorting issue

Hey guys, I'm building a little test app that gives you the smallest amount of coins that you can use to make a specific value. Here is the program running, and here is my code

I'm having an issue, where when it gets to a certain number, it's breaking. Do I need to use Ceiling or Floor in the code? I just find it weird as I swear I built this exact same program with roughly the same code in Uni and it worked?

Every if/else if statement is the same as these, and then it prints out the coins, but due to the weird issue, it never gets to 0. I guess I could add an if statement to check if it is less than 0.01

Thank you
image.png
image.png
Was this page helpful?