[java]代码库
Scanner input = new Scanner(System.in);
int number_Of_DaysInMonth = 0;
String MonthOfName = "Unknown";
System.out.print("Input a month number: ");
int month = input.nextInt();
System.out.print("Input a year: ");
int year = input.nextInt();
bai
if (month == 1){
MonthOfName = "January";
number_Of_DaysInMonth = 31;
}else if(month == 2){
MonthOfName = "February";
if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
number_Of_DaysInMonth = 29;
} else {
number_Of_DaysInMonth = 28;
}
}else if (month == 3){
MonthOfName = "March";
number_Of_DaysInMonth = 31;
}