Practice · 3 of 4
Digit Sum
CHALLENGE
Difficulty: beginner+25 XP
Implement int digit_sum(int n) summing the decimal digits of n (n >= 0). Use % 10 and / 10 in a loop.
Press Submit to check your solution.
Back to lesson: Practice: Loop Gym
Practice · 3 of 4
Implement int digit_sum(int n) summing the decimal digits of n (n >= 0). Use % 10 and / 10 in a loop.
Back to lesson: Practice: Loop Gym