Home » C Programs » C Program to Find Leap Year or Not

C Program to Find Leap Year or Not

Basic program to execute c program to find leap year or not. This program will print the leap year or not program in the c program. How to check the year is a leap year or not program in c language. This will check the year leap or not by %4 with the year.

If Else Statement in C

In C, the if-else statement is used to carry out operations based on a set of conditionsIf and only if the supplied condition is true, the operations stated in the if block are executed.

Leap Year and Why It Happens Every Four Years

The Earth’s orbit around the Sun takes around 365.25 days – a solar year. The days in a calendar year are commonly rounded to 365. Every four years, we add one day to our calendar to compensate for the missing partial day. 

There are 366 days in a year, so there are 366 days in a year. This is referred to as a leap year. To understand the concept and to implement program like c program to find leap year or not 

Why February Month is Leap Year

Because February was the last day of the year, an extra date was added in February to ensure that the first day of spring always coincided with the correct time. 

A leap year occurs every four years on average, but there are outliers. If a year is equally divisible by four, it is a leap year. 

C Program to Find Leap Year or Not

//C Program to Find Leap Year or Not
#include<stdio.h>
int main() 
{
int year;
printf("Enter the year");
scanf("%d", &year);
if (year % 400 == 0) 
{
printf("%d is a leap year", year);
}
else if (year % 100 == 0) 
{
printf("%d is not leap year", year);
}
else if (year % 4 == 0)
{
printf("%d is a leap year", year);
}
else
{
printf("%d is not leap year", year);
}
return 0;
}

Output 

Enter the year

2020

2020 is a leap year