Subscribe Us

header ads

To find a given year is leap or not !



C Program to find a given year is Leap or Not !

#include<stdio.h>
#include<conio.h>
main()
{
    int y;
    printf("enter any year...");
    scanf("%d",&y);
    if(y%100==0)
    {
      if(y%400==0)
    printf("%d is a leap year",y);
    else
    printf("%d is not a leap year,y");  
    }
    else
    {
      if(y%4==0)
      printf("%d is a leap year",y);
      else
      printf("%d is not a leap year"
      ,y);
  }
}

Output :- 
enter any year...2014
2014 is not a leap year

Post a Comment

0 Comments