# 1 – C program for leap year, easy and simple code

## C program for leap year

C program to check leap year :

We know that there are 365 day in a year but it is wrong. in one year there are 365.25 days. Hence every 4 year we have one extra day.

We have to use simple mathematics logic to solve this problem.

If year is divided by 4 then it is leap year.

If year is divided by 4 and not by 100 then it is leap year.

If year in not divisible by 4 then it is not a leap year.

If year is divisible by 4 and 100 then it must be divisible by 400 otherwise it is not a leap year.

`#include<stdio.h>int main(){    int year;    printf("Enter year : ");    scanf("%d",&year);    if(year % 4 == 0)    {        if( year % 100 == 0)        {            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 :

Enter year : 2006

2006 is not a leap year

### Connect with us on following platforms

We are aiming to explain all concepts of C in easiest terms as possible.
ITVoyagers
Author