Answer:
The code is given below in C with appropriate comments
Step-by-step explanation:
#include <stdio.h>
#include <stdbool.h>
bool ISLeapYear(int userYear)
{
// If a year is multiple of 400,
// then it is a leap year
if (userYear % 400 == 0)
return true;
// Else If a year is multiple of 100,
// then it is not a leap year
if (userYear % 100 == 0)
return false;
// Else If a year is multiple of 4,
// then it is a leap year
if (userYear % 4 == 0)
return true;
return false;
}
int main(void) {
int year;
printf("Enter year : ");
scanf("%d",&year);
if(ISLeapYear(year)){
printf("%d is a leap year.",year);
}else{
printf("%d is not a leap year.",year);
}
return 0;