打印出100以内不包含7的所有数(java)

public class Sersq {
    public static void main(String[] args) {
        for (int i = 1; i <= 100; i++) {
            String str = String.valueOf(i);
            int a = 0;
            for (int j = 0; j <= str.length() - 1; j++) {
                if (str.charAt(j) == '7') {
                    a++;
                }
            }
            if (a == 1 || a == 2) {
                continue;
            } else {
                System.out.print(i + " ");
            }
        }
        System.out.println();
    }
}

你可能感兴趣的:(javase)