import java.util.Scanner;
public class Day {
public static void main(String[] args) {
int[] days = {31,0,31,30,31,30,31,31,30,31,30,31};
Scanner in = new Scanner(System.in);
System.out.println("输入年份:");
int year = in.nextInt();
System.out.println("输入月份:");
int mouth = in.nextInt();
System.out.println("多少号:");
int day = in.nextInt();
if (year % 100 != 0) {
if (year % 4 == 0) {
days[1] = 29;
} else {
days[1] = 30;
}
} else {
if (year % 400 == 0) {
days[1] = 29;
} else {
days[1] = 30;
}
}
int all = 0;
mouth -= 2;
for (int i = 0; i <= mouth; i++) {
all += days[i];
}
System.out.println(all+day);
}
}
纯手打~~~
时间: 2024-10-25 05:25:59