java实现猜生日

** 猜生日**

今年的植树节(2012年3月12日),小明和他的叔叔还有小伙伴们一起去植树。休息的时候,小明的同学问他叔叔多大年纪,他叔叔说:“我说个题目,看你们谁先猜出来!”
“把我出生的年月日连起来拼成一个8位数(月、日不足两位前补0)正好可以被今天的年、月、日整除!”
他想了想,又补充到:“再给个提示,我是6月出生的。”
根据这些信息,请你帮小明算一下,他叔叔的出生年月日。
答案写在“解答.txt”中,不要写在这里!

格式是年月日连成的8位数。
例如,如果是1948年6月12日,就写:19480612

参考答案:
19550604

public class Main1 {
    
    public static void main(String[] args) {
        for(int i = 19000000;i < 19990000;i++) {
            if(i % 2012 == 0 && i % 3 == 0 && i % 12 == 0) {
                int temp = i / 100 % 10;
                int temp1 = i / 1000 % 10;
                if(temp == 6 && temp1 == 0)
                    System.out.println(i);
            }
        }
    }
}
原文地址:https://www.cnblogs.com/a1439775520/p/13077048.html