Sum of Digits
EasyMath
Description
Given a non-negative integer n, return the sum of its decimal digits.
Examples
Input:
n = 38Output:
11Explanation:
Adding the individual digits of 38 together totals 11.
Input:
n = 0Output:
0Explanation:
Adding the individual digits of 0 together totals 0.
Input:
n = 99999Output:
45Explanation:
Adding the individual digits of 99999 together totals 45.
Constraints
- •
0 ≤ n ≤ 10⁹