上传程序运行结果;
上传程序核心代码。
其实就是看2000~2050能被4整除的数,代码为:
public class Main {
public static void main(String[] args) {
System.out.println("2000~2050年之间的闰年有:");
for (int i = 2000; i <= 2050; i++) {
if (i % 4 == 0) {
System.out.print(i + " ");
}
}
}
}
运行结果:
温馨提示:答案为网友推荐,仅供参考