Problem: Write a program in C to check whether the given year is leap year or not.

Example:

A year is said to be a leap year if it is divisible by 4. It mostly occurs every 4 years but every 100 years we skip a leap year unless it is divisible by 400.

If one year is divisible by 4, it is not necessary that it is a leap year. The following condition must be satisfied to be called a leap year:

  • If a year is divisible by 4 then it should not be divisible by 100.
  • Otherwise, the year should be divisible by 400.

If neither of the condition gets satisfied then the year is not a leap year.

Here is the source code to check leap year in C:

Output 1:

Enter the year
2020
Leap Year


Output 2:

Enter the year
2021
Not a Leap Year


In this tutorial we learned to check leap year in C. If you have any doubts or suggestions then please comment below.

Leave a Reply

two + 6 =