Find minimum number of coins that make a given value: Difference between revisions

Added AutoHotkey
(Find minimum number of coins that make a given value en Yabasic)
(Added AutoHotkey)
Line 181:
1 * 2
1 * 1</pre>
 
=={{header|AutoHotkey}}==
<lang AutoHotkey>coins := [1, 2, 5, 10, 20, 50, 100, 200]
val := 988
 
result := ""
while val
{
coin := coins.pop()
if (val//coin)
result .= val//coin " * " coin "`n", val -= val//coin * coin
}
MsgBox, 262144, , % result
return</lang>
{{out}}
<pre>4 * 200
1 * 100
1 * 50
1 * 20
1 * 10
1 * 5
1 * 2
1 * 1</pre>
 
=={{header|AWK}}==
<lang AWK>
299

edits