In comp.lang.javascript message <c5b2342f-98c5-4065-ba9c-67d60bebd3ec@h1
1g2000prf.googlegroups.com>, Mon, 28 Jan 2008 21:28:49, stalin
i have one problem suppose if we given a number 163 as
input the out put of the number is
one --100
one--- 50
one---10
one-- 2
one--1
That's been answered adequately. Maybe mod the quantity-in-hand with
the first not-completed coin to get the new q-i-h, and divide the
difference to get the count of that coin. But, in some currencies, that
might not be the optimum division. To change pre-war five-pound note,
it would not be efficient to start with four guineas; four shillings was
better done with two florins than by starting with a half-crown.
It's more interesting to see in how many ways a sum can be split into
coins - see <URL:
http://www.merlyn.demon.co.uk/js-misc1.htm#JAD>, in
Cacheing. £1.63 can be split into coin in 30698 ways, using coins 100,
50, 20, 10, 5, 2, 1. Without cacheing it takes me 6 seconds, with
cacheing it is too quick to measure.
But I have seen your grave; in a flower-bed outside the Kremlin wall,
where you were deposited after being deemed unworthy to remain beside
Vladimir Ilyich.
It's a good idea to read the newsgroup c.l.j and its FAQ. See below.