Practice · 4 of 5
Sum of Digits In Range
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** Print the sum of decimal digit sums of every integer from 1 to N.
**Input:** One line: N (1 <= N <= 10^6).
**Output:** One integer — the total (fits in 64 bits).
**Example:** 12 -> 45 (digits 1..9 sum 45; 10,11,12 add 1+2+3=6... total 51?
No: 1..9 gives 45, plus 1+0+1+1+1+2 = 6, so 45+6 = 51).
Press Submit to check your solution.
Back to lesson: Practice: Contest Technique Problem Set