[The sum of special numbers] `%10` takes the ones digit each time

sum of special numbers

n % 10Only the number on the number is taken each time.
Such as: 1234 % 10 = 4; 1234 / 10 = 123;123 % 10 = 3 …

private static boolean cheak(int n) {
    
    
	while (n != 0) {
    
    
		int a = n % 10;
		if (a == 2 || a == 0 || a == 1 || a == 9) {
    
    
			return true;
		}
		n /= 10;
	}
	return false;
}

Guess you like

Origin blog.csdn.net/m0_60641871/article/details/129748330