#include <stdio.h>
int isLeapYear( int year) {
return (year%4 == 0) && (year%100 != 0 || year%400 == 0);
}
int main() {
int year;
printf("Enter a year ");
scanf("%d", &year);
if (isLeapYear(year)) {
printf("The %d is a leap year", year);
}
else {
printf("The %d is not a leap year", year);
}
return 0;
}
Comments
Leave a comment