Functions
Function-36
Function-37
Function-38
~/algor $ cat problems/funksiya-raqamlar-yigindisi-eng-katta
Sum of the digits
Easy
1000 ms
128 MB
29%
Write a function DigitSum(x) that returns the sum of the digits of the positive integer $x$.
Example 1: DigitSum(123) → 6 — $1 + 2 + 3 = 6$.
Example 2: DigitSum(9045) → 18
Write only the function body.
Input
One line with a positive integer $x$ — the argument of the function.
Output
The value returned by the function: an integer.
Note
$1 \le x \le 10^{15}$
Examples
Input #1
123
Output #1
6
Input #2
9045
Output #2
18