Check whether a year is a leap year or not
This progam shows how to check whether a given year is a leap or not.
//to find whether year is leap or not
/*
**********************
www.botskool.com
**********************
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int year,leap=0;
clrscr();
printf("Enter any Year : ");
scanf("%d",&year);
if(year%4==0)
leap=1;
if(!((year%100==0)==(year%400==0)))
leap=0;
if(leap)
printf("\n %d is a LEAP Year",year);
else
printf("\n %d is a NOT a LEAP Year",year);
getch();
}
/*
**********************
www.botskool.com
**********************
*/
Output of the above program will be like this:-

Terms of Agreement:
By using this code, you agree to the following terms-
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this code (for example to a web site) without written permission from us. Failure to do so is a violation of copyright laws.
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which may have placed in the code or code's description.
Tags:



Recent comments
1 day 13 hours ago
1 day 13 hours ago
2 days 13 hours ago
1 week 1 day ago
1 week 1 day ago