array size not sufficient coz n can be greater than 10000 try x[1000000], y[1000000] :-)
On Sun, Jun 17, 2012 at 9:32 PM, Mayank Singh <singh13490may...@gmail.com> wrote: > here is my code for the above problem: > > #include<stdio.h> > #include<stdlib.h> > > int main() > { > int i,x[10000],y[10000],val; > long n; > scanf("%d",&n); > for(i=0;i<n;i++) > { > scanf("%d",&x[i]); > scanf("%d",&y[i]); > } > for(i=0;i<n;i++) > { > if(x[i] == y[i] && x[i]%2 == 0) > { > val = x[i]+y[i]; > printf("%d\n",val); > } > else if(x[i] == y[i] && x[i]%2 != 0) > { > val = (x[i]+y[i])-1; > printf("%d\n",val); > } > else if(x[i] != y[i] && x[i]%2 == 0 && (x[i]-y[i]) == 2) > { > val = (x[i]+y[i]); > printf("%d\n",val); > } > else if(x[i] != y[i] && x[i]%2 != 0 && (x[i]-y[i]) == 2) > { > val = (x[i]+y[i])-1; > printf("%d\n",val); > } > else > printf("No Number\n"); > } > return 0; > } > > > i am getting WA . plz help me regarding this. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. -- -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.