Ans nhi aa rha shi

in my code if the value of either x or y is negative then the corresponding conditions are not executed
#include
using namespace std;

int main() {
int x=0,y=0;
char ch[20];
cin>>ch;
for(int i=0;ch[i]!=’\n’;i++)
{if(ch[i]==‘N’)
y++;
else if(ch[i]==‘E’)
x++;
else if(ch[i]==‘W’)
x–;
else if(ch[i]==‘S’)
y–;
}
if(x>0)
{for(int j=1;j<=x;j++)
cout<<“E”;
}
else if(x<0)
{for(int j=x;j>=1;j++)
cout<<“W”;
}
if(y>0)
{for(int j=1;j<=y;j++)
cout<<“N”;
}
else if(y<0)
{for(int j=y;j>=1;j++)
cout<<“S”;
}
return 0;
}

Hi Aditi, please share the link of the corresponding question as well.