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<stdio.h> #include<conio.h> //LEAP YEAR PROGRAM void main() { int n; clrscr(); printf("ENTER A YEAR:- "); scanf("%d",&n); if(n%4==0) { printf("GIVEN YEAR IS LEAP YEAR."); } else { printf("GIVEN YEAR IS NOT A LEAP YEAR."); } getch(); }
ENTER A YEAR:- 2018 GIVEN YEAR IS NOT A LEAP YEAR.