RosettaCodeData/Task/Count-the-coins/SETL/count-the-coins.setl
2023-12-16 21:33:55 -08:00

14 lines
380 B
Text

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;