
public class Ex05_LeapYearSum {

	public static boolean isLeapYear(int year) {
		boolean bLeapYear;
		bLeapYear = (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0));
		return bLeapYear;
	}

	public static void main(String[] args) {
		int sum = 0;
		for (int y = 1; y <= 101; y++) {
			if (isLeapYear(y + 1911)) {
				sum += y;
			}
		}
		System.out.printf("民國1年到民國101年所有潤年的和＝ %d\n", sum);
	}
}
