X279: Recursion Programming Exercise: Sum of the Digits

For function 'sumOfDigits', write the missing recursive call. This function takes a non-negative integer and returns the sum of its digits.

Examples:

sumOfDigits(1234) -> 10

Your Answer:

x
 
1
public int sumOfDigits(int number) {
2
 if (number < 10)
3
  return number;
4
 return <<Missing a Recursive case action>>
5
}
6
Reset

Feedback

Your feedback will appear here when you check your answer.