How to judge a leap year?

How to judge a leap year?


The year divisible by 4 but not 100 or 400 is a leap year
That is to say:
1. A year that does not end with 0 and can be divided by 4 but not by 100 is a leap year
2. A year ending in 0 is a leap year if it is divisible by 400



Java judge whether it is leap year
1. Write a program to output the year numbers of all leap years from 2000 to 3000 A.D., and change one line for every 10 year numbers
(1) If the number of A.D. years can be divided by 4, but not by 100, it is a leap year;
(2) It is also a leap year that the number of A.D. years can be divided by 400;
To complete the code,


class LeapYear{
boolean isLeapYear(int year){
if((year%4==0&&year%100!=0)||year%400==0)
return true;
else
return false;
}
public static void main(String args[]){
int count=0;
for(int i=2000;i



Is 2100 a leap year


1. Generally, the leap year can be divided by 4
2. If it's a multiple of 100 but not a multiple of 400, it's not a leap year, that is, if the last two digits are both zero, divide it by 400
For example, 1700, 1800, 1900 and 2100 are not leap years, but 2000 and 2400 are
3. 2100 is not a leap year. The leap year is not judged by adding 4 as you said. So some leap years occur once every 4 years, but some occur once every 8 years. For example, 1896 is a leap year, but 1900 is not. It is a leap year only in 1904
This rule was made by Gregorian 13th in the 16th century in order to make the calendar accurate
In Gregorian calendar (Gregorian calendar), the year with leap day is called leap year. The general year is 365 days, and the leap year is 366 days. Because the earth's cycle around the sun is 365 days, 5 hours, 48 minutes and 46 seconds (365.24219 days), that is, a regression year, the Gregorian calendar sets a year as 365 days. The remaining time is about four years, one day in total, added to February, so the normal year is 365 days, February is 28 days, leap year is 366 days, February is 29 days. Therefore, there are 97 leap years in every 400 years. The leap year increases by one day at the end of February, and the leap year is 366 days. The calculation method of leap year: the number of years in the ad era can be divided by four, that is, leap year; the number of years divided by 100 but not by 400 is equal year; the number of years divided by 100 but not by 400 is leap year. For example, 2000 is leap year, but 1900 is not
The following is an example of calculating the leap year of the Gregorian calendar:
S = InputBox ("please enter year:)
n = Val(s)
If n Mod 400 = 0 Or (n Mod 4 = 0 And n Mod 100 0) Then
Msgbox S + "it's a leap year!"
End If
1900 and 2100 are not divisible by 400, so: No



The judgment method of leap year


① A leap year is an ordinary year that can be divided by 4 and not by 100
② The leap year is divisible by 400
③ For a year with a large number, if 3200 and 172800 are divisible, it is a leap year. For example, 172800 is a leap year, and 86400 is not