Thursday, 27 October 2011

C program to check leap year

WRITE A PROGRAM TO CHECK WHETHER A YEAR IS LEAP OR NOT



#include<stdio.h>
#include<conio.h>
void main()
{
  int y;
  printf("Enter the year:\n");
  scanf("%d",&y);
  if(y%4==0 && (y%100!=0 || y%400==0))
   printf("The year is leap");
  else
   printf("The year is not leap");
  getch();
}




Output:
  Enter the year:
  2000
  The year is leap

No comments:

Post a Comment