📅  最后修改于: 2022-03-11 14:44:50.376000             🧑  作者: Mango
// sum the digits of an integer
int getSum(long long n) {
int sum = 0;
int m = n;
while(n > 0) {
m = n % 10;
sum = sum + m;
n = n / 10;
}
return sum;
}