Sunday, September 2, 2012

Program to Find Leap year in C Program

Program to Find Leap year in C Program


The program for find out the given year under leap year are or not. Leap year logic is simple as the year which divisible by 400 or divisible by 4 and not by 100 .

/* Program For Finding Leap Year*/
#include<stdio.h>

int main()
{
int yr;
printf("\nEnter year\n");
scanf("%d",&yr);
if( (yr%4==0 && yr%100!=0) || yr%400==0)
{
  printf("\n%d is Leap year!\n",yr);
}
else
{ printf("\n%d is Not a Leap year..!\n",yr);
}
return 0;


}

0 comments:

Post a Comment