The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


i need help in finding an algorithm in java

Posted by Matt Gerrans on February 21, 2002 at 4:39 PM

> Hi,
> looking for an algorith that will calculate the least amount of change. User inputs some amount and program will calculate the lowest cobination of dollar,cents,quarters for the exact amount.

It is quite easy; just start with your larget denomination and take that away from the amount, until the amount is smaller than it and work your way down the (larger to smaller) denominations this way (keeping a count for each) until the amount is 0.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us