[Cialug] Algorithm

Morris Dovey cialug@cialug.org
Fri, 14 Jan 2005 18:34:40 -0600


David Stout wrote:

> Without using logic just integer arithmetic what would the
> algorithm be for finding how many quarters, dimes, nickles &
> penneys in .92.

Pennies <- 100 * Amount
Quarters <- Pennies / 25
Pennies <- Pennies - Quarters * 25
Dimes <- Pennies / 10
Pennies <- Pennies - Dimes * 10
Nickles <- Pennies / 5
Pennies <- Pennies - Nickles * 5

-- 
Morris Dovey
West Des Moines, Iowa USA