Tuesday, 28 October 2014

Check whether a year is a leap year or not



Check whether a year is a leap year or not





/*WAP to check whether a year is a leap year or not*/


#include<stdio.h>
#include<conio.h>
void main()
{
int yr;
clrscr();
printf("enter the year:");
scanf("%d",&yr);
if(yr%400==0||(yr%4==0  && yr%100!=0))
printf("%d is a leap year",yr);
else
printf("%d is not a leap year",yr);
getch();
}

OUTPUT:
enter the year:2000
2000 is a leap year


No comments:

Post a Comment