In this program below, user is asked to enter a year and this program checks whether the year entered by user is leap year or not.

Some of the leap years are :

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.

#### The pseudo code is to check leap year is

if year is divisible by 400 then is_leap_year

else if year is divisible by 100 then not_leap_year

else if year is divisible by 4 then is_leap_year

else not_leap_year

### Example#5.0: C++ program to check leap year without function:

###

Output

Enter a year : 2016

2016 is a leap year.

###

Example#5.1: C++ program to check leap year using function:

#### Output

Enter a year : 2016

2016 is a leap year.

## Post a Comment