Overview:
Leap years has an extra, or intercalary, day which is added to the end of the shortest month, February. The February 29, is commonly referred to as leap day or intercalary day. This article Shows communicate the definition of year, leap year, and century year. Furthermore, I will demonstrate and write logic for checking leap year. After all, I will show a C program to check leap year.
Table of contents:
- What is a Year?
- What do you mean by Leap year?
- What do you mean by century Leap year?
- Identification of Leap Years
- How to find the Leap Years?
- C program to check leap year
- Conclusion
What is a Year?
The time taken by the earth to make one revolution around the sun. It is the period of 365 days (or 366 days in leap years) a new year generally starting from the first of January and ending with 31st of December. It is used for reckoning time in ordinary circumstances. For instance, The time period from 1 April 2020 to 31 March 2021 is accpted as 1 Year that has 365 days but the time period from 1 January 2000 to 31 December 2000 is accpted as 1 Year that has 366 days and also it is a leap year because fabrury, 2000 has 29 days.
What do you mean by Leap year?
Leap years has an extra, or intercalary, day which is added to the end of the shortest month, February. The February 29, is commonly referred to as leap day or intercalary day. Leap years have 366 days instead of the usual 365 days and occur almost every four years. For instance, If the year 1996 is a leap year then next leap year will be year 2000. Other examples, 1999 is not a leap year 2000 is a leap year 2004 is a leap year
What do you mean by century Leap year?
A century leap year is a leap year in the Gregorian calendar that is divisible by 400. For example, the years 1600, 2000, and 2400 are century leap years since those numbers are divisible by 400, while 1700, 1800, 1900, 2100, 2200, and 2300 are common leap years despite being divisible by 4 but 1997 is not a leap year because it is not divisible by 4.
Identification of Leap Years
How to find the Leap Years?
- Step 1: Take a variable and store a year into it as integer.
- Step 2: If year is exactly divisible by 4.
- Step 3: Then the year is leap year.
- Step 4: Else year is not divisible by 4, year is normal year.
C program to check leap year
#include int main() { int year; printf("Enter a year: "); scanf("%d", &year); if (year % 4 == 0) { printf("%d is a leap year.", year); } else { printf("%d is not a leap year.", year); } return 0; }
The output of the Program:
Conclusion:
This Program accepts year from users and check whether the given year is leap year or not using ladder if else.