View Single Post
Old 02-15-2008, 10:57 AM   #4 (permalink)
jaeusm
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: C# Ideas - Working With Coins & Bills

The algorithm for solving the problem is shown below. However, you'll probably want to put it in its own method so you don't keep copying and pasting code that performs the same operation several times in a row.

Code:
double money = 1234.70;  // arbitrary value chosen

int hundreds = money / 100;  // determine the number of hundreds
money -= hundreds * 100;  // subtract all the hundreds

// now do the same thing for each group (fifties, tens, fives, ...)
Does this solve your problem?
jaeusm is offline