Add digits solution


  • 0
    K
    public static int addDigits(int num) {  
    while(true){  
    int y = num%10; 
    num = num/10; 
    num = num+y; 
    if(num<10)break; 
    } 
    return num; 
    }
    

Log in to reply
 

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