C Program to Find if a given Year is a Leap Year

program:
#include<stdio.h>
int main()
{
  int year;
  printf("Enter the year : ");
  scanf("%d",&year);
  if(year%400==0)
  {
    printf("%d is leap year",year);
  }
  else if(year%100==0)
  {
    printf("%d is not a leap year",year);
  }
  else if(year%4==0)
  {
    printf("%d is a leap year",year);
  }
  else
  {
    printf("%d is not a leap year",year);
  }
 }
output:
Previous Post Next Post