C program to check whether a year is a leap year or not.
Code: C
/*
** C program to check whether an entered year is a leap year or not
** @author: Pradeep
** @date: 02/12/06
*/
#include<stdio.h>
int main(void)
{
int year;
printf("Enter the year: ");
scanf("%d",&year);
/*
** The logic is that the year is either divisible by both
** 100 and 4 , OR its only divisible by 4 not by hundred
*/
if(year%400 ==0 || (year%100 != 0 && year%4 == 0))
{
printf("Year %d is a leap year",year);
}
else
{
printf("Year %d is not a leap year",year);
}
return 0;
}


