Rule #1: A year is called leap year if it is divisible by 400.
For example: 1600, 2000 etc leap year while 1500, 1700 are not leap year.
For example: 1600, 2000 etc leap year while 1500, 1700 are not leap year.
Rule #2: If year is not divisible by 400 as well as 100 but it is divisible by 4 then that year are also leap year.
For example: 2004, 2008, 1012 are leap year.
CODE ::
#include <stdio.h>
void main ()
{
int year;
printf("Enter a year: ");
scanf("%d",&year);
if((year%4==0)&&(year%100!=0)||(year%400==0))
printf("LEAP YEAR\n");
else
printf("NOT LEAP YEAR\n");
}
No comments:
Post a Comment