Originally Posted by

**aussiemcgr**
You will need to tell us what you are getting and what you expect. "It isn't working" does not provide us with enough information.

Also, are you familiar with the mod function? Basically, mod returns the remainder after division. You can simply your logic this way.

For example, let's take the following value with your layout: $3.85

1. Two Dollars: (int)($3.85 / 2) = 1.

2. double tracker = 3.85 % 2 = 1.85

3. One Dollar: (int)(tracker / 1) = 1.

4. tracker = tracker % 1 = 0.85

5. Fifty Cents = (int)(tracker / .5) = 1

6. tracker = tracker % .5 = 0.35

7. Twenty Cents = (int)(tracker / .2) = 1

8. tracker = tracker % .2 = 0.15

9. Ten Cents = (int)(tracker / .1) = 1

10. tracker = tracker % .1 = 0.05

11. Five Cents = (int)(tracker / .05) = 1

12. tracker = tracker % .05 = 0

This way you don't have to redo the math for each part over and over again, which obviously reduces the risk of a mathematical mistake.

Just my 5 cents (pun intended)