Given a non-negative integer n, return the sum of its digits.
Example 1: Input: n = 1234 Output: 10
Example 2: Input: n = 7 Output: 7
Constraints: 0 <= n <= 1000000000
Given a non-negative integer n, return the sum of its digits.
Example 1: Input: n = 1234 Output: 10
Example 2: Input: n = 7 Output: 7
Constraints: 0 <= n <= 1000000000
Copyright 2026 algowars. All rights reserved.
Input 1 (integer)
7
Output 1 (integer)
7