Sum digits of an integer: Difference between revisions

Easylang
(Easylang)
Line 1,767:
29
29</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
proc sumdig s$ . r .
r = 0
for c$ in strchars s$
h = strcode c$ - 48
if h >= 10
h -= 39
.
r += h
.
.
call sumdig "1" r ; print r
call sumdig "1234" r ; print r
call sumdig "fe" r ; print r
call sumdig "f0e" r ; print r
</syntaxhighlight>
 
=={{header|Elixir}}==
2,060

edits