C program to check leap year
#include <stdio.h>
int main()
{
int year;
printf("Enter a year to check if it is a leap year\n");
scanf("%d", &year);
if (year%400 == 0) // Exactly divisible by 400 e.g. 1800, 2000
printf("%d is a leap year.\n", year);
else if (year%100 == 0)
printf("%d isn't a leap year.\n", year);
else if (year%4 == 0) // Exactly divisible by 4 and neither by 100 nor 400 e.g. 2020
printf("%d is a leap year.\n", year);
else
printf("%d isn't a leap year.\n", year);
return 0;
}