Any year is input by the user. Write a program to determine whether the year is a leap year or not.

Source Code

#include<iostream>
using namespace std;

int main()
{
	int year;

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

	if( (year%400==0 || year%100!=0) &&(year%4==0))
		cout<<"It is a leap year";
	else
		cout<<"It is not a leap year";


	return 0;
}


Output

SAMPLE RUN # 1

Enter the year : 1996
It is a leap year

SAMPLE RUN # 2

Enter the year : 2011
It is not a leap year

SAMPLE RUN # 3

Enter the year : 1900
It is not a leap year

SAMPLE RUN # 4

Enter the year : 2000
It is a leap year