int addDigits(int num) { return (num != 0 && num%9 == 0)?9:num%9; } 转载于:https://www.cnblogs.com/sean10/p/5059155.html