用java众键盘输入四位数的起始年与结束年份,输出闰年是有哪些?(用while循环)
简单的程序参考
public static void main(String[]args) {
Scanner sc=new Scanner(System.in);
int b=sc.nextInt();
int e=sc.nextInt();
while(b<=e)
{
if (((b%4==0)&&(b%100!=0))||b%400==0)
System.out.println(b);
b++;
}
}
热门标签: