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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.