Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/
#include <stdio.h>
#include <string.h>
int main()
{
int a,b;
long long int c,d,e,f;
char aa[201], bb[10], cc[201], dd[10], ee="PAR", ff="IMPAR";
scanf("%d", &a);
for(b=1; b<=a; b++)
{
scanf("%s %s %s %s", aa,bb,cc,dd);
scanf("%lld%lld", &c, &d);
e=c+d;
if(bb[0]=='P')
{
if(e%2==0) printf("%s\n", aa);
else printf("%s\n", cc);
}
else
{
if(e%2==0) printf("%s\n", cc);
else printf("%s\n", aa);
}
}
return 0;
}
line 13 scanf("%s %s %s %s", &aa,&bb,&cc,&dd) lack "&"
ReplyDeleteWhen you take string as input, its no need to use "&".
Deleteyour answer error
ReplyDeleteAfter getting your comment, i submitted my solution again and it gets accepted.
Delete