C++ program to find leap year using nested if

C++ program to find leap year using nested if. Check the year is leap or not program in C++. This program will check the year whether it is leap year or not. Here’s the easiest way to find the year is leap year or not in simple c++ program for beginners in c++ programming language.

#include <iostream>
using namespace std;
int main() 
{
int year;
cout << "Enter the number";
cin >> year;
if (year % 4 == 0)
{
if (year % 100 == 0)
{
if (year % 400 == 0)
cout << year << " is leap year";
else
cout << year << " is not leap year";
}
else
cout << year << " is leap year";
}
else
cout << year << " is not leap year";
return 0;
}

Output:

Enter the number

2020

2020 is leap year