Search This Blog

Sep 27, 2013

C program to check leap year or not leap year

/* to check leap year or not*/
#include<stdio.h>
#include<conio.h>
void main()
{
int y;
clrscr();
printf("Enter Year:");
scanf("%d",&y);
if(y%4==0)
{
 if (y%100==0)
 {
  if (y%400==0)
     printf("\n%d is a Leap Year",y);
  else
  printf("\n%d is not a Leap Year",y);
  }
 else
 printf("\n%d is not a Leap Year");
 }
else
printf("\n%d is not a Leap Year");
getch();
}

No comments:

Post a Comment