C++ Program to Check if Given Year is Leap Year or Not

Write C++ Program to Check if Given Year is Leap Year or Not

// CPP Program to check if given year is leap year or not

#include <iostream>

using namespace std;

int main()
{
	int year;

	cout << "Enter the year :--> ";
	cin >> year;

	if(year % 4 == 0)  //if the remainder becomes zero then leap year
	{
		cout << "The entered year is leap year ";
	}
	else
	{
		cout << "The entered year is not a leap year ";
	}

	return 0;
}

Output:

Enter the year :--> 1996
The Entered year is leap year

Enter the year :--> 2022
The entered year is not a leap year

≪ Previous | Next ≫