Count Integers With Even Digit Sum
给一个range[1,num], 求里面有多少数的digit sum是偶数.
class Solution {
public int countEven(int num) {
int res = 0;
for(int i = 1; i <= num; i++){
int even = 0;
int cur = i;
while(cur != 0){
even += (cur % 10);
cur /= 10;
}
if(even % 2 == 0)
res++;
}
return res;
}
}