Laasya looking at the friends birthday list on a social media site likes to find if the particular person's birthday year is a leap year or not. Since many will have the same doubt she decides to automate the task by writing the code snippet for finding the same but she don't know the logic to write it. Can you help Laasya to accomplish her task?
#include <stdio.h>
int main() {
int year;
scanf("%d", &year);
if (year % 400 == 0)printf("LEAP YEAR");
else if (year % 100 == 0) printf("NOT A LEAP YEAR");
else if (year % 4 == 0)printf("LEAP YEAR");
else printf("NOT A LEAP YEAR");
return 0;
}
Comments
Post a Comment