Sum digits of an integer: Difference between revisions

Add Draco
(Add CLU)
(Add Draco)
Line 1,399:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/Sum_digits_of_an_integer#Pascal Pascal].
 
=={{header|Draco}}==
<syntaxhighlight lang="draco">proc nonrec digitsum(word n; byte base) byte:
byte sum;
sum := 0;
while n>0 do
sum := sum + n % base;
n := n / base
od;
sum
corp
 
proc nonrec main() void:
writeln(digitsum(1, 10));
writeln(digitsum(1234, 10));
writeln(digitsum(0xFE, 16));
writeln(digitsum(0xF0E, 16))
corp</syntaxhighlight>
{{out}}
<pre>1
10
29
29</pre>
 
=={{header|Elixir}}==
2,124

edits