by Dinesh Thakur

A year is leap if it is divisible by 4 but not by 100 or is divisible by 400. Thus, 1996, 2000 and 2004 are leap years but 1900, 2002 and 2100 are not. The program segment given below determines whether a given year (of type int) is leap or not.


#include<stdio.h>
#include<conio.h>
void main()
{
       int year;
       clrscr();
       printf("Enter a Year : ");
       scanf("%d",&year);
       if(year%4==0&&year%100!=0||year%400==0)
         {
              printf("Leap Year");
          }
       else
         {
              printf("Not a Leap Year");
          }
              getch();  
}
Output :
Enter a Year : 2013
Not a Leap Year