Byang’s friend was asked to author a programming problem where the challenge was to identify if the …

Click here to read the complete problem statement.

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

#include <stdio.h>
int main()
{
int x;
scanf("%d",&x);
if(x%4 ==0){
printf("Yes");
}
if(x%100 == 0 && x%400 == 0){
printf("Yes");
}
else printf("No");
return 0;
}
I'm getting wrong answer on the last test case here. The Gregorian criteria says It's a leap year if :
"The year can be evenly divided by 4;
If the year can be evenly divided by 100, it is NOT a leap year, unless;
The year is also evenly divisible by 400. Then it is a leap year."

Nevermind i fixed out. Did not understand the statement before. #include <stdio.h>
int main()
{
int x;
scanf(“%d”,&x);
if(x%4 ==0 && x%100 !=0){
printf(“Yes”);
}
else if(x%400 == 0){
printf(“Yes”);
}

else printf("No");
return 0;

}
This one worked, so it’ll be a leap year ALWAYS if it is evenly divided by 400. and it’ll also be a leap year if it is evenly divided by 4 and also not evenly divided by 100

I know this is an old topic but as @touhidurrr stated.

However, methode to determine a leap year is simple.

The year have to be evenly divided by 4 but not by 100.

However, the year which is evenly divided by 400 is always a leap year.

You are checking whether the input is divisible without a remainder by 4 or by 400 or by 100. Over in this line:

if user_input % 4 == 0 or user_input % 400 == 0 or user_input % 100 == 0:

Rather you should check to see if the input is divisible by 4 and not divisible by 100. Then check if the requirements aren’t satisfied whether the input is divisible by 400. Finally if none of the two checks are triggered then printout No

Hopefully this helps out if anyone is having a problem