Leap Year Program in C

Last Updated : 17 Aug, 2026

A leap year is a year that has an extra day in February, making it 29 days instead of 28. Therefore, a leap year contains 366 days instead of the usual 365 days.

  • Checks whether a given year is a leap year or not.
  • A year is a leap year if it is divisible by 400, or divisible by 4 but not by 100.

Conditions for a Leap Year

A leap year occurs once every four years and to check whether a year is a leap year, the following conditions should be satisfied:

  • It is a multiple of 4 but not of 100, or
  • It is a multiple of 400.

For example, 2000 is a leap year but 1900 is not.

C
#include <stdbool.h>
#include <stdio.h>

bool checkYear(int year)
{
    // If a year is multiple of 400, then it is a leap year
    if (year % 400 == 0)
        return true;

    // Else If a year is multiple of 100, then it is not a leap year
    else if (year % 100 == 0)
        return false;

    // Else If a year is multiple of 4, then it is a leap year
    else if (year % 4 == 0)
        return true;
    // if no above condition is satisfied, then it is not a leap year
    return false;
}

int main()
{
    int year = 2000;

    if (checkYear(year))
    {
        printf("Leap Year");
    }
    else
    {
        printf("Not a Leap Year");
    }
    return 0;
}

Output
Leap Year
Comment