日期:2014-05-20 浏览次数:20708 次
import java.util.Scanner;
public class tianshu{
public static void main(String[] args){
Scanner A=new Scanner(System.in);
System.out.println("从哪一年开始:");
int a;
Scanner B=new Scanner(System.in);
System.out.println("从哪一年开始");
int b;
int day=0;
for(a=A.nextInt(),b=B.nextInt();a<=b;a++){
if(a%4==0&&a%100!=0||a%400==0){
day=day+366;
}else{
day=day+365;
}
}
System.out.println("总天数为:"+day+"天");
}
}
public static void main(String[] args){
Scanner A=new Scanner(System.in);
System.out.println("从哪一年开始:");
int a = A.nextInt();
Scanner B=new Scanner(System.in);
System.out.println("从哪一年结束");
int b = B.nextInt();
int day=0;
for(;a<=b;a++){
if(a%4==0&&a%100!=0
------解决方案--------------------
a%400==0){
day=day+366;
}else{
day=day+365;
}
}
System.out.println("总天数为:"+day+"天");
}