Count the coins: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Minor tidy) |
Not a robot (talk | contribs) (Add SETL) |
||
Line 3,504: | Line 3,504: | ||
99341140660285639188927260001 |
99341140660285639188927260001 |
||
</pre> |
</pre> |
||
=={{header|SETL}}== |
|||
<syntaxhighlight lang="setl">program count_the_coins; |
|||
print(count([1, 5, 10, 25], 100)); |
|||
print(count([1, 5, 10, 25, 50, 100], 1000 * 100)); |
|||
proc count(coins, n); |
|||
tab := {[0, 1]}; |
|||
loop for coin in coins do |
|||
loop for i in [coin..n] do |
|||
tab(i) +:= tab(i - coin) ? 0; |
|||
end loop; |
|||
end loop; |
|||
return tab(n); |
|||
end proc; |
|||
end program;</syntaxhighlight> |
|||
{{out}} |
|||
<pre>242 |
|||
13398445413854501</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |