Simple C Code


  • 0
    int addDigits(int num) {
        if (num < 10)
            return num;
        else{
            num %= 9;
            return (num > 0) ? num : 9;
        }
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.