import java.util.Scanner;
class TestYear
{
public static void main(String[] args)
{
Scanner s= new Scanner(System.in);
System.out.println("请输入年份:");
int year=s.nextInt();
System.out.println("请输入月份:");
int month=s.nextInt();
System.out.println("请输入日期:");
int day = s.nextInt();
int sum=0;
switch(month){
case 12:
sum +=30;
case 11:
sum +=31;
case 10:
sum+=30;
case 9:
sum +=31;
case 8:
sum +=31;
case 7:
sum+=30;
case 6:
sum +=31;
case 5:
sum +=30;
case 4:
sum +=31;
case 3:
if(year % 4==0 && year % 100 !=0){
sum +=29;
}else{
sum +=28;
}
case 2:
sum +=31;
case 1:
sum += day;
}
System.out.println(sum);
}
}
转载于:https://blog.51cto.com/9815936/1600412