Project 1

Leap year calculation (Leap year is a year that has 366 days, a year that has 365

days is not a leap year)

Write a program that will accept a positive integer ( the year to be tested) from a user. If

the user inputs a 0 or negative number, the program quits without doing anything.

Otherwise, it will print a message saying whether or not the year is a leap year based on

the following rules.

The rules to calculate if it is a leap year are:

(a) A year divisible by 4 is a leap year (2004, 2008...), unless

(b) it is also divisible by 100 (2100, 2200...) in which case it is not a leap year.

(c) There is an exception. A year divisible by 400 is a leap year (2000, 2400...).

Here are examples of how the program works.

Input a number for the year (>= 1): -1

Sorry, your year must be greater than 1.

Input a number for the year (>= 1): 2001

The year 2001 is (a leap year) or ( not a leap year)

Input a number for the year (>= 1): 2004

The year 2004 is (leap year) or ( not a leap year)

Input a number for the year (>= 1): 2100

The year 2100 is not a leap year

0