Important C Programs

C Program to Check Leap Year

//C Program to Check Leap Year
//Header Files
#include<stdio.h>
#include<conio.h>

void main()
{

int year;
clrscr();
printf("Enter a year: ");
scanf("%d",&year);
if(year%4 == 0)
{

if( year%100 == 0)
{

// year is divisible by 400, hence the year is a leap 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);

}
getch();

}

Output


You can also see a video how to run this program