Ad
  • Custom User Avatar

    Read the comments next time you think you encounter an issue.

    Your code only calculates the sum of digits once, but you need to keep summing the digits of the new number if the number is less than 10. Read the description, it states that the function is recursive, so you have to keep doing it until there is only one digit. The input value is 195, the expected value is 6 and your code returns 15.

    n = 195
    
    1 + 9 + 5 = 15
    1 + 5 = 6