Problem: Write a program in C to check whether a 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 a year is divisible by 4 then it is not necessary that it is a leap year. To be called a leap year the following condition should be satisfied:

  • If a year is divisible by 4 then it should not be divisible by 100.
  • Or 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

Output 2

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

Leave a Reply