Leap Year Program in c.

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.

Leap Year Program

What is leap year?

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.

How program will work?

Program of leap year in c.


	#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();
	}
	

Output:


	ENTER A YEAR:- 2018
	GIVEN YEAR IS NOT A LEAP YEAR.

Post Your Comment