This program to finds whether the given year is leap year or not
Output:--
Enter the year 2021
the given year 2011 is not leap year
#include<stdio.h>
#include<math.h>
main() {
int year, b;
printf("Enter the year\t");
scanf("%d", &year);
b = year % 4;
if(b == 0) {
printf("the given year %d is leap year\n", year);
} else {
printf("the given year %d is not leap year\n", year);
}
}
Output:--
Enter the year 2021
the given year 2011 is not leap year
How it works
It finds whether the input year is divisible by 4 or not. If it remainder is 0 then it treats as a leap year and shows this year is leap year else shows given year is not leap year.