# C Program to Check Leap Year

**Leap year**

All years which are perfectly divisible by 4 are leap years except for century years( years ending with 00 ) which is a leap year only it is perfectly divisible by 400. For example: 2012, 2004, 1968 etc are leap year but, 1971, 2006 etc are not leap year. Similarly, 1200, 1600, 2000, 2400 are leap years but, 1700, 1800, 1900 etc are not.

This program asks user to enter a year and this program checks whether that year is leap year or not.

## Source Code to Check Leap Year

```
/* C program to check whether a year is leap year or not using if else statement.*/
#include <stdio.h>
int main(){
int year;
printf("Enter a year: ");
scanf("%d",&year);
if(year%4 == 0)
{
if( year%100 == 0) /* Checking for a century year */
{
if ( year%400 == 0)
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
}
else
printf("%d is a leap year.", year );
}
else
printf("%d is not a leap year.", year);
return 0;
}
```

**Output 1**

Enter year: 2000 2000 is a leap year.

**Output 2**

Enter year: 1900 1900 is not a leap year.

**Output 3**

Enter year: 2012 2012 is a leap year.