Monday, June 18, 2012

To find whether the entered year is leap year or not


/* To find whether the entered year is leap year or not */

#include<stdio.h>

#include<conio.h>

void main()

{

 int year;

 clrscr();

 printf("Enter year: ");

 scanf("%d",&year);

 /* Checking for leap year */

 if(year%4 == 0 && year%100 != 0)

   printf("\n Leap Year");

 else if(year%400 == 0)

   printf("\n Leap Year");

 else

   printf("\n Not Leap Year");

 getch();

}

 

OUTPUT

Enter year: 1960

 

 Leap Year

 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.