What
you should do is to explain to yourself how to do the calculation with pencil and paper. Like this:
(1) I have $63.97. So how many $10 bills can I use? Well, I divide 6397 by 1000 and get 6.
(2) Okay, so now I have $63.97. So how many $5 bills can I use? Well, I divide 6397 by 5 and get 12.
... At this point you're going to stop me and explain what I did wrong. But that's what your code does. If you can fix my faulty calculation, then do the same fix to your code.