Practice · 1 of 3
Private Helper
CHALLENGE
Difficulty: beginner+25 XP
Implement int digit_sum(int n) using a static helper int digit_sum_nonneg(int n) for n >= 0; digit_sum itself handles negatives by summing the digits of the absolute value.
Press Submit to check your solution.
Back to lesson: Practice: Organization Practice