Calculate digit sum of a number x.

DigitSum(x)

Arguments

x

an integer number

Value

the digit sum

Author

Andri Signorell <[email protected]> based on code by Julius benchmarked by Uwe

See also

Examples

DigitSum(c(124, 45, 268))
#> [1]  7  9 16
# [1]  7  9 16