132k views
4 votes
A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:

1) The year must be divisible by 4

2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400; therefore, both 1700 and 1800 are not leap years

Some example leap years are 1600, 1712, and 2016.

Write a program that takes in a year and determines whether that year is a leap year.

Ex: If the input is:

1712
the output is:

1712 - leap year
Ex: If the input is:

1913
the output is:

1913 - not a leap year

User ZAY
by
8.0k points

1 Answer

5 votes

Final answer:

A leap year in the Gregorian Calendar occurs every 4 years to align with the Earth's orbit. It has 366 days and any year that is divisible by 4 is a leap year, except for century years which must also be divisible by 400.

Step-by-step explanation:

The determination of whether a year is a leap year in the Gregorian Calendar involves understanding its rules. A leap year has 366 days instead of the usual 365, and it occurs every 4 years to account for the Earth's approximately 365.2425-day-long orbit around the sun. The criteria for a leap year are as follows:

  • The year must be divisible by 4.
  • If the year is a century year (ending in 00), it must also be divisible by 400 to be a leap year.

For example, while the year 2000 was a leap year because it is divisible by both 4 and 400, the years 1700, 1800, and 1900 were not, as they are not divisible by 400 despite being divisible by 4.

User Ryyker
by
8.7k points