Find minimum number of coins that make a given value: Difference between revisions
Find minimum number of coins that make a given value (view source)
Revision as of 11:43, 15 April 2024
, 1 month agoAdded Easylang
m (→{{header|Wren}}: Minor tidy) |
(Added Easylang) |
||
Line 495:
=={{header|EasyLang}}==
<syntaxhighlight>
sum = 988
coins[] = [ 200 100 50 20 10 5 2 1 ]
#
for coin in coins[]
n = sum div coin
if n > 0
print "coins of " & coin & ": " & n
sum -= n * coin
.
.
</syntaxhighlight>
{{out}}
<pre>
coins of 200: 4
coins of 100: 1
coins of 50: 1
coins of 20: 1
coins of 10: 1
coins of 5: 1
coins of 2: 1
coins of 1: 1
</pre>
=={{header|F_Sharp|F#}}==
|