public static void main(String[] args) {
Scanner input =new Scanner(System.in);
//输入年份
System.out.println("请输入年份:");
int year=input.nextInt();
//输入月份
System.out.println("请输入月份:");
int month=input.nextInt();
//输入日期
System.out.println("请输入日期:");
int day=input.nextInt();
int sum=day;//累加求和的值 存到sum中
for (int i = 1; i<=month-1; i++) {
switch (i) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
sum+=31;
break;
case 2:
//判断这一年是不是闰年
if(year%40&&year%100!=0||year%4000) {
sum+=29;//如果是闰年就29天
}else {
sum+=28;//如果不是就28天
}
break;
case 4:
case 6:
case 9:
case 11:
sum+=30;
break;
}
}
System.out.println(year+"年"+month+"月"+day+"日是这一年的第"+sum+"天");
}