import java.io.*;
public class question10 {
public static void main(String args[])throws IOException {
BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
int input,month;
while (true){
System.out.print("請輸入年份:");
input=Integer.parseInt(buf.readLine());
System.out.print("請輸入月份:");
month=Integer.parseInt(buf.readLine());
if ((month>=1)&&(month
System.out.println("輸入錯誤!");
}
boolean k=false;
if (input%4==0){
if (input%100!=0){
k=true;
}
else{
if (input%400!=0)
k=false;
else
k=true;
}
}
else
k=false;
switch (month){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
System.out.println("大月31天!");
break;
case 4:
case 6:
case 9:
case 11:
System.out.println("小月30天!");
break;
case 2:
if (k) System.out.println("閏年小月29天!");
else System.out.println("非閏年小月28天!");
break;
}
}
}
留言列表