Wrie a Script to find whether given year is a leap year or not?

Leap Year: All years which are perfectly divisible by 4 are leap years except for century years (years ending with 00) which are a leap year only it is perfectly divisible by 400. For example: 2012, 2004, 1968 etc. are leap year but, 1971, 2006 etc. are not leap year. Similarly, 1200, 1600, 2000, 2400 are leap years but, 1700, 1800, 1900 etc. are not.
All years evenly divisible by 4, except for centennial years that are NOT evenly divisible by 400, are leap years.

So basically, every 4th year is a leap year. The year 2000 was a leap year because it was a centennial year (ends in two zeros) and it IS evenly divisible by 400. The next centennial year (2100) will NOT be a leap year.

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.


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.
  

Out Put Of the Above Program










No comments:

Post a Comment