In this tutorial learn how you can write a c program to read a year and determine if it is leap year or not.

A leap year is exactly divisible by 4 except for century years. Century years are those years ending with 00. The century year is a leap year only if it is perfectly divisible by 400.

We are using if else and else if condition in two different ways.

C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.

## Write a Program to Check a Number Odd or Even using Bitwise Operator

Here is the code to read a year and determine if it is leap year or not in C programming.

### First Method to Check Leap Year

`#include <stdio.h> //WAP to read a year and determine if it is leap year or not.int main(){    int year;    printf("Please enter year:");    scanf("%d",&year);    if(year%4==0){       if (year%100==0){  //Checking if it is century year or not        if(year%400==0){            printf("%d is leap a year.",year);        } else printf("%d isnot a leap year.",year);       } else  printf("%d is leap a year.",year);    }      else printf("%d isnot a leap a year.",year);    return 0;}`

## Test Live At Jdoodle

### Second Method to Check Leap Year

`#include <stdio.h> //WAP to read a year and determine if it is leap year or not.int main(){    int year;    printf("Please enter year:");    scanf("%d",&year);    if((year%4==0) && ((year%400==0) || (year%100!=0)))        printf("%d is leap year",year);    else printf("%d isnot a leap year",year);    return 0;}`

## Conclusion

This is how you can read a year and determine if it is a leap year or not in c programming. Comment below if you like our tutorial.

Categorized in: