int n=3215; while(n>0){ int mod=n%10;//得到余数,且余数是从后往前的 n/=10; } 今天做的两道LeetCode都用到了这个知识点。 1295 统计位数为偶数的数字 1281 整数的各位积和之差