Watermelon Problem.

Hey can someone help me what i might be doing wrong in this problem?

#include 
int main()
{
    int w;
    scanf("%d",&w);
    if(w % 2 == 0)
        printf("YES");
    else
        printf("NO");
    return 0;
}
1 Like

Hey,

Even though your logic is correct.

I guess you just misunderstood the problem.

after dividing, both parts should be non-zero even weighted.

example :

6 --> 2 4 YES

2 --> 2 0 NO

Here you are checking even before dividing, but question said, after dividing both parts should be non-zero even numbers(Need Not To Be Equal).

The Way A explained

My Other Solution

Your Corrected Solution

Happy Coding

hope you don’t mind to upvote this answer…:slight_smile: