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

Content added Content deleted
(Added AutoHotkey)
(Added 11l)
Line 17: Line 17:
one coin of 1
one coin of 1
<br><br>
<br><br>

=={{header|11l}}==
{{trans|Python :: Procedural}}

<lang 11l>V denominations = [1, 2, 5, 10, 20, 50, 100, 200]
V total = 988
print(‘Available denominations: ’denominations‘. Total is to be: ’total‘.’)
V (coins, remaining) = (sorted(denominations, reverse' 1B), total)
L(n) 0 .< coins.len
(V coinsused, remaining) = divmod(remaining, coins[n])
I coinsused > 0
print(‘ ’coinsused‘ * ’coins[n])</lang>

{{out}}
<pre>
Available denominations: [1, 2, 5, 10, 20, 50, 100, 200]. Total is to be: 988.
4 * 200
1 * 100
1 * 50
1 * 20
1 * 10
1 * 5
1 * 2
1 * 1
</pre>


=={{header|Action!}}==
=={{header|Action!}}==