Problem

Return the sum of the digits of a non-negative n (use a while loop).

Examples

  • digitSum(123) -> 6
  • digitSum(0) -> 0
Compile and test (Ctrl+Enter)