source code in c language to find leap year .
Code:
source code in c language to find leap year .
#include <stdio.h>
int main() {
int year;
printf("Enter a any year: ");
scanf("%d", &year);
if (year % 4 == 0) {
if (year % 100 == 0) {
// the year is a leap year if it is divisible by 400.
if (year % 400 == 0)
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
} else
printf("%d is a leap year.", year);
} else
printf("%d is not a leap year.", year);
return 0;
}
OUTPUT
Enter a year: 1900
1900 is not a leap year.
Comments
Post a Comment