static int digitsSum(int n) { if (n < 0) { return -1; } if (n < 10) { return n; } else { return n % 10 + digitsSum(n / 10); } }
0 Comments