China Naming Network - Eight-character query< - Why do you dance every four years instead of a hundred years? How can you use a computer to calculate?

Why do you dance every four years instead of a hundred years? How can you use a computer to calculate?

The most fundamental reason is that the earth's orbit around the sun is 365 days, 5 hours, 48 minutes and 46 seconds (365 days +09 days), which is the tropic of cancer.

(Tropical Year). The Gregorian calendar has an average of only 365 days a year, which is about 0.2422 days shorter than the tropical year.

Days, the remaining time of four years is about one day, so four years plus 1 day in February makes the calendar year of that year 366 days, and this year is a leap year. The current Gregorian calendar has 97 leap years every 400 years. According to every four years

In leap years, the average annual calculation will be 0.0078 days, so after 400 years, it will be about 3 days. So every 400 years, three leap years will be reduced. Therefore, the Gregorian calendar stipulates that when a year is 100, it must be

Leap year must be a multiple of 400; A year that is not a multiple of 400 or even a multiple of 4 is not a leap year.

This is what is usually said: jump in four years, not jump in a hundred years, and jump again in four hundred years. For example, 2000 is a leap year, and 2 100 is a normal year.

C language code:

if((year % 4 = = 0 & amp; & amp Year% 100! =0)|| (year% 400 = = 0)) a =1;

else a = 0;

If(a== 1) // Yes == No =, = indicates assignment = = indicates judgment.

Printf("\n%d This year is a leap year \n ",year);

Else printf("%d This year is not a leap year \n ",year);

//Instead of dividing, take the remainder, that is, calculate the remainder. If the remainder is 0, it means divisible.