WHAT'S NEW?
Loading...

C Program to check Leap Year

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

0 comments:

Post a Comment