For the above attached question, I am trying to solve the question . When I’m running the code in vs code I am getting the proper output but here when sumbitted it shows wrong answer. Anyone please help me. I am attaching my code below;
#include <stdio.h>
int main(void)
{
int T;
scanf("%d",&T);
while(T--)
{
int a,b,c,d; // initial coins all four have
printf("Enter the number of coins Nitin has initially: ");
scanf("%d",&a);
printf("Enter the number of coins Sobhagya has initially: ");
scanf("%d",&b);
printf("Enter the number of coins Ritik has: ");
scanf("%d",&c);
printf("Enter the number of coins Satyarth has: ");
scanf("%d",&d);
if (a>=b)
{
int e=b+c; // ritik gives to sobhagya
if (a>=e) // still nitin has more
{
int f=e+d; // satyarth gives to sobhagya
if(a>=f)
{
printf("N \n");
}
else
{
printf("S \n");
}
}
else // sabhogya has more
{
int g=d+a; // ritik gives to nitin
if (g>=e)
{
printf("N \n");
}
else
{
printf("S \n");
}
}
}
else //if sabhogya has more
{
int h=a+c; // ritik gives to nitin
if (h>=b) // nitin has more
{
int i=d+b; // satyarth gives to sobhagya
if(h>=i) // nitin has more
{
printf("N \n");
}
else
{
printf("S \n");
}
}
else // sobhagya has more
{
int j=h+d; // satyarth gives to nitin
if(j>=b) // nitin has more
{
printf("N \n");
}
else{
printf("S \n");
}
}
}
}
return 0;
}