Check leap year using C programming

Manish Tamang

Manish Tamang / April 19, 2024

1 min readNaN views


#include <stdio.h>
int main() {
int year;
// Input the year
printf("Enter a year: ");
scanf("%d", &year);
// Check if it's a leap year
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
printf("%d is a leap year.\n", year);
} else {
printf("%d is not a leap year.\n", year);
}
return 0;
}