"KEEP LEARNING, DON'T STOP."
"KEEP LEARNING, DON'T STOP."
In this section you will learn how to check whether a year is leap year or not. Just simple mathematic operation we will perform to check the leap year. In this program we are taking the year as input from the user.
A leap year is a calendar year containing one additional day. Leap years are needed to keep our modern day in alignment with the Earth's revolutions around the sun.
#include<iostream.h> #include<conio.h> //LEAP YEAR PROGRAM void main() { int n; clrscr(); cout<<"ENTER A YEAR:- "; cin>>n; if(n%4==0) { cout<<"GIVEN YEAR IS LEAP YEAR."; } else { cout<<"GIVEN YEAR IS NOT A LEAP YEAR."; } getch(); }
ENTER A YEAR:- 2018 GIVEN YEAR IS NOT A LEAP YEAR.