Leap year

A leap year is a calendar year that includes an additional day to synchronize the calendar year with the astronomical or seasonal year. – Wikipedia

Logic

The Logic to check this is quite simple. We only need to check if the given year is multiple of 4 or 400, but it should not be multiple of 100.

Program

#include <stdio.h>

int main() {

    int year;

    printf("Enter a year : ");
    scanf("%d", &year);

    if ((year % 4 == 0 || year % 400 == 0) && (year % 100 != 0)) {

        printf("\n%d is a leap year.", year);

    } else {

        printf("\n%d is not a leap year.", year);
    }

    return 0;
}

Output

Enter a year : 2012
2012 is a leap year.