Leap year C program

/*Program to find a year is century leap year or not and a simple leap year or not*/

#include<stdio.h>
#include<conio.h>
int main()
{
 int year;
 printf("Enter Year : ");
 scanf("%d",&year);
 if(year%100==0)
 {
  if(year%400==0)
    printf("\n%d is century leap year",year);
  else
    printf("\n%d is not century leap year",year);
 }
 else
 {
  if(year%4==0)
    printf("\n%d is leap year",year);
  else
    printf("\n%d is not leap year",year);
 }
 getch();
 return 0;
}
    Output of above program :

Enter year : 2012
2012 is leap year

Comments