Coding challenge
Mark Wieder
mwieder at ahsoftware.net
Wed Jan 30 23:29:10 EST 2013
Paul-
Wednesday, January 30, 2013, 8:21:36 PM, you wrote:
> And here's my simple logical non-mathematician version!
> function coinChange pChange
> repeat for each item x in "50, 20, 10, 5, 2, 1"
> repeat while pChange >= x
> subtract x from pChange
> add 1 to y
> end repeat
> if y > 0 then put y && "x" & x & "c" & cr after tResult
> put 0 into y
> end repeat
> return tResult
> end coinChange
You did the same nested repeat thing I did.
And everyone but me seemed to think of listing the number of coin
types. I got lazy and just repeated the coin if necessary.
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list