Find minimum number of coins that make a given value: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Minor tidy) |
(Added Easylang) |
||
Line 495: | 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#}}== |
=={{header|F_Sharp|F#}}== |