Featured
- Get link
- X
- Other Apps
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"
*/
#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"
- Get link
- X
- Other Apps
Labels:
c program to check leap year condition
c++ program for checking leap year
c++ program to check leap year or not
c++ program to find leap year
c++ program to show leap year
Popular Posts
C++ program to display numbers which get reversed after multiplying by 4
- Get link
- X
- Other Apps
Comments
Post a Comment