**Find leap year** : In this tutorial, we are going to learn new program which is program for leap year

leap year program in cpp is very simple and easy program to write.

**What is a leap year**

Leap year is calendar year having one extra day which is to make a synchronized and seasonal year. Leap year contains 366 days while one ordinary year has 365 days.

**Rules for leap year**

1. The year is leap year which is perfectly divided by 4 – excepts for year divisible by 100 and not by 400.

2. The century years are leap years such as 1600, 2000 and century year 1700, 1800,1900 are not leap year.

**How we find leap year:**

1. The number (year) perfectly divisible by 400 and 4 is a leap year.

2. And number perfectly divided by 100 and other year are not leap year.

Now, we know how to find year is a leap year or not, so let’s see leap year program in cpp

**Algorithm**:

this *algorithm* show how to *Find* given number is a *leap year* or not.

1. Start

2. Take input year from the user.

3. Check condition for leap year.

4. If it’s leap year print number is a leap year.

5. Otherwise, print number is not leap year.

6. End.

# C++ Program to Check Leap Year

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include <iostream> using namespace std; int main() { int year; cout<<"Enter the year you want to check\n"; //take a user input cin>>year; //check leap year. if(year%400==0) { cout<<year <<" is leap year\n"; } else if(year%100==0) { cout<<year <<" is not leap year\n"; } else if(year%4==0) { cout<<year <<" is leap year\n"; } else { cout<<year <<" is not leap year\n"; } return 0; } |

**Output:**

#### Explanation

**1. Execution starts with the main function.**

**2. Declare variable **

=> year tostore year input

**3. Next we take a year input from user**

cin>>year;

=> year = 2019

**4. Now main logic to find year year leap year or not.**

if(year%400==0) => condition false

else if(year%100==0) {

=> condition false

else if(year%4==0)

=> condition false

else { => else block executed

cout<<year <<” is not leap year\n”; => 2019 is not leap year

}

**5. End with the program.**

## Leave a Reply