/**
* Created with IntelliJ IDEA.
* Description:
* User: Wu Ruixi
* Date:2019/10/17
* Time:19:28
**/
public class Work2_4 {
// 输出 1000 - 2000 之间所有的闰年
public static void main(String[] args) {
int a = 0;
for (a = 1000; a <= 2000; a++) {
if (a % 4 == 0) {
if (a % 100 != 0) {
System.out.print(a + " ");
}
} else if (a % 400 == 0) {
System.out.print(a + " ");
}
}
}
}
输出 1000 - 2000 之间所有的闰年
最新推荐文章于 2022-11-04 14:04:05 发布