why i am getting wrong answer in this code for farmer feb problem

#include<stdio.h>

int main()
{

int t,x,y,i,c=1,j;
int p=0;
scanf("%d\n",&t);
while(t–)
{
scanf("%d%d",&x,&y);
for(i=y+x+1;i<2010;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
{c++;p=1;break;
}
}
if(p==0)
{
break;
}
if(p==1)
{
p=0;
}

}
printf("%d\n",c);

}

return 0;
}

Its showing correct output in my compiler,but showing ‘wrong answer’ here…please do me a favor,its my first problem i am working on

This is the accepted version of your code. You have to make the counter equal to “1” for every test case.

1 Like

Thank you :slight_smile: