C++ Program to Check Leap Year

| Last Updated: | In: C++ Tutorial


This program will check the entered year by the user is a leap year or not. In this program, we have used the if…else statement to check the leap year.

Pseudo code to check leap year

  1. if year is divisible by 4 then is_leap_year
  2. else if year is divisible by 100 then not_leap_year
  3. else year is divisible by 400 then is_leap_year
  4. else not_leap_year

Copy the below program and execute it to check the leap year.

Example: how to check leap year using C++ program

Output:

#first try
Please enter a year in number: 2004
2004 is a leap year.
#second try
Please enter a year in number: 2006
2006 is a leap year.


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


You may also like:

Tags: , , , , ,