[Cialug] Algorithm

Morris Dovey cialug@cialug.org
Fri, 14 Jan 2005 20:32:06 -0600


Jerry Weida wrote:

> not sure if this counts as "logic" but here's how I'd do it:
> 
> quarters = amount / 25
> amount = amount - quarters * 25
> dimes = amount / 10
> amount = amount - dimes * 10
> nickels = amount / 5
> amount = amount - nickels * 5
> pennies = amount

Jerry...

Yabbut -- the initial value for amount is $0.92  (:

-- 
Morris Dovey
West Des Moines, Iowa USA