Skip to main content

Practice · 1 of 6

Digit Sum

CHALLENGE
Difficulty: beginner+25 XP

**Description:** Given a positive integer n, print the sum of its digits. **Input:** One integer n (1 ≤ n ≤ 10^18). **Output:** One integer — the digit sum. **Example:** 1234 → 1+2+3+4 = 10.

Back to lesson: Practice: Loop Patterns Set