# Check Leap Year

“** Check Leap Year**” is a basic programming exercise problem. Here, we are given a year, entered by user and our task is to check whether an entered year is a leap year or not.

**Condition for leap year: **

- The primary condition for leap year is that it is divisible by 4.
- If the entered year is century year (i.e., 100,200,300 etc.), then it must be divisible by 400. Else, it will not be a leap year.

**Example:**

Year = 2000INPUT:Leap YearOUTPUT:Year = 2019INPUT:Not Leap YearOUTPUT:

**C++ Program to check whether a year is leap year or not is as follows:**

#include<bits/stdc++.h> using namespace std; int main() { int year; //Scan the year cout<<"Enter the year:"; cin>>year; // Primary condition : Year must be divisible by 4 if(year % 4 == 0) { // Condition for century Year if(year %100 == 0) { // Century Year must be divisible by 400 if(year % 400 == 0) { cout<<"Leap Year"; } else { cout<<"Not Leap Year"; } } else { cout<<"Leap Year"; } } else { cout<<"Not Leap Year"; } }

Enter the year: 2000 Leap YearOUTPUT:

**Related Posts:**

**Program to find sum of first ‘n’ natural numbers.****Program to Reverse a Number.****Program to swap two Numbers.****Program to print Fibonacci Series up to Nth Term.****Program to find and print nth Fibonacci number.****Program to find Power of the Number.****Program to find Quotient and Remainder.****Program to find largest amongst three numbers.****Program to find factorial of a number.****Program to find GCD of two numbers.****Program to find LCM of two numbers.****Program to check whether entered number is odd or even.****Program to check whether entered number is prime number or not.****Program to check whether entered number is palindrome or not.****Program to check whether entered number is Armstrong Number or Not.****Program to convert binary number to octal number.****Program to convert binary number to decimal number.****Program to convert binary number to hexadecimal number.****Program to convert octal number to binary number.****Program to convert octal number to decimal number.**