# Program to Display Leap Year

## Palindrome of Given Number

We will write a C program to check whether a given year is leap year or not and the number of year will be entered by the user. This will help to understand the basic structure of programming. In this program , we will check whether a given number is a leap year or not easily by using proper syntax and algorithms.

## Working of Program :

In the program, we will require some numbers from the user to check whether a given number is a leap year or not.

### Important Note for Palindrome:

• A leap year is a year which is commonly divisible by 4. Leap year contains 366 days in the year and it comes after every 4 years.
For example: 2000,2004,2008,2012,2016…

### Syntax for Conditional Statement:

```If(condition)
{
// Statements
}
else{    // Statements}If{    // Statements}
```

### Problem 1

Write a program to check whether a given number is a leap year or not by using conditional statement.

• Firstly, we have to enter the any year.
• Then print that year is leap year or not.

### Code

Run
```#include<stdio.h>
int main() {
int year = 2004;
if (year % 400 == 0) {
printf("%d year is a leap year.", year);
}
else if (year % 100 == 0) {
printf("%d year is not a leap year.", year);
}
else if (year % 4 == 0) {
printf("%d year is a leap year.", year);
}
else {
printf("%d year is not a leap year.", year);
}
return 0;
}
```

### Output

```2004 year is a leap year.
```

### Note:

In the following program we will check whether a given number is a leap year or not using if – else statement.

### Syntax for If-Else Statement:

```If(condition)
{
// Statements
}
else{    // Statements}
```
```Problem 2
```

Write a program to check whether a given number is a leap year or not using if – else statement.

• Firstly, we have to enter the any year.
• Then print that year is leap year or not.

### Code

Run
```#include<stdio.h>
int main ()
{
int year = 5607;
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
printf ("This year is a leap year.");
else
printf ("This year is not a leap year.");
return 0;

}
```

### Output

```This year is not a leap year.
```

### Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

## Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others