My issue
The code is to satisfy the Equation 2X+7Y = N, where X & Y can be ‘0’. Input is only N with ‘t’ number of test cases. if the equation satisfies, it need to give “Yes” as output else “No”.
My code is working fine and giving the required output. Instead the system is is showing the code as incorrect on submission.
My code
// Update the code below to solve the problem
#include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int N;
scanf("%d",&N);
if (N%2 == 0)
{
printf("Yes\n");
}
else if(N%7 == 0)
{
printf("Yes\n");
}
else
{
while(N>=7)
{
N=N-7;
}
if (N%2== 0)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
}
return 0;
}
Learning course: C for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone