A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400.
#include
#include
void main()
{
int n;
clrscr();
printf(“enter any year: ”);
scanf(“%d”,&n);
if(n%4==0 && n%100 !=0 || n%400 ==0)
printf(“year is a leap year”);
else printf(“year is not a leap year”);
getch();
}
Output:
enter any year: 1947 year is not a leap year