📜  添加数字java代码示例

📅  最后修改于: 2022-03-11 14:52:26.798000             🧑  作者: Mango

代码示例1
public static int sumDigits(int number){
        if (number < 10) return -1;
        int sum = 0;
        while (number > 10){
             sum += number % 10;
            number /= 10;
        }
        return sum + number;