Skip to main content

Let’s take a look at how to check leap year in C Programming. I am referring to an awesome book called “Let us C” by “Yashwant Kanetkar” and I will post solutions to the questions asked in exercises. This is the third program of the second chapter: The Decision Control Structure. Please come back for more programs. If you are unsure about any part and more information, put it down in the comments section below or look it up on Google if you want a quick response. We try to answer all the queries as soon as possible.

Question:

Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not. (Hint: Use the % (modulus) operator)

Solution to Check Leap Year in C Programming:

Again, this is a very simple program. All you have to do is ask the user to input a year to check if it is a leap year or not. Then using the if-else conditional statements, check if the year is a leap or not. A leap year is always divisible by 4. So if the year entered by the user is divisible by 4, then the entered year is a leap year and vice-a-versa. Dumb Fact: A leap year has 29 days in February.

Download the source code:

Download Program

Program to Check Leap Year in C Programming:

//C Program to Check Leap year - ReadMeNow
#include<stdio.h>
#include<conio.h>
main()
{
  int year;
clrscr();
printf("\n Enter the Year you want to find the leap year for - ");
scanf("\n %d",&year);
if(year%4!=0)
{
 printf("\n  %d The year you entered is not a leap year.",year);
}
else
{
 printf("\n %d year is a leap year",year);
}
return(0);
}

Output

Enter the Year you want to find the leap year for – 2011

2011 The year you entered is not a leap year.

Download the source code:

Please don’t forget to subscribe to us before you hit the download button! It helps us grow and provide more content.

Download Program

Read Also:

Introduction to C Programming

Multiplying two numbers in C

How to Calculate Simple Interest in C Programming

Calculate gross salary in C

Print ASCII Values Using While Loop in C Program

Harsh Shah

A highly motivated individual with a hunger to learn and share as much as I can about everything. Masters in Interaction Design with a Bachelors in Computer Science. I have worked with clients across the globe on various design and tech projects. I believe in giving back and that's how ReadMeNow was founded.

Leave a Reply