// 開始列印簡單的萬年曆印到月 import java.io.*; public class a12a { public static void main(String args[]) throws Exception { //程式進入點 String getbr; BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); int year;//存放西元年 int last_year;//存放去年 int days;//去年的天數 int month; int space,i,weekpt; int[] month_day={31,28,31,30,31,30,31,31,30,31,30,31}; //月份的天數 String[] weekname = {"日","一","二","三","四","五","六"}; String[] monthname = {"一月","二月","三月","四月","五月","六月","七月", "八月","九月","十月","十一月","十二月"}; while (true) { System.out.print("請輸入西元年(輸入0結束):"); getbr = br.readLine(); if (getbr.equals("0")) return; year=Integer.parseInt(getbr);//取得西元年 System.out.print("請輸入月(1-12的正整數):"); getbr = br.readLine(); month=Integer.parseInt(getbr);//取得月 // 判斷該年是否為閏年 if (year%400==0) //閏年 month_day[1]=29; else if (year%100==0)//平年 month_day[1]=28; else if (year%4==0)//閏年 month_day[1]=29; else//平年 month_day[1]=28; last_year=year-1; days=last_year*365+last_year/4-last_year/100+last_year/400; //西元元年1月1日是週一 System.out.println("西元元年到去年為止總共有"+days+"天"); //加上今年到上個月的天數 for (i=0;i