Skip to main content

Featured

functions in Python

c++ program for checking leap year

/* Following program checks whether the entered year is a Leap Year or Not 
*/

#include<iostream.h>
void main()
{
int year;
cout<<"\nEnter a Year\n";
cin>>year;
if(year%100!=0&&year%4==0)
{
cout<<"LEAP YEAR";
}
else if(year%100==0&&year%400==0)
{
cout<<"LEAP YEAR";
}
else
{
cout<<"NOT A LEAP YEAR";
}
}

NOTE: A year is leap year :
(1) if it is not a century year and divisible by 4
(2) if it is a century year and divisible by 400   

else the year is "NOT LEAP YEAR"

Comments

Popular Posts