In this example, we will take year as input and check entered year is leap year or not.

A leap year is a year that has 29 days in the month of February. This is done to keep the calendar year the same as the astronomical year because astronomical years have a quarter of a day more than the calendar year. This is why a leap year occurs once every 4 years.

To determine whether a year is a leap year, follow these steps:

- If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5.
- If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4.
- If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5.
- The year is a leap year (it has 366 days).
- The year is not a leap year (it has 365 days).

Example :

` ````
#include <stdio.h>
int main() {
int year;
printf("Enter year: ");
scanf("%d", &year);
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
printf("%d is a leap year", year);
else
printf("%d is not a leap year", year);
return 0;
}
```

Output :

` ````
//Output :- 1
Enter year: 2020
2020 is a leap year
//Output :- 2
Enter year: 2021
2021 is not a leap year
```

Ask anything about this examples