Test case 2 fail

#include
using namespace std;
int main()
{
long long int a,b,c;
char ch;

cin>>ch;

while(ch!='x' && ch!='X')
{
    if(ch=='+')
    {
        cin>>a>>b;
        c=a+b;
        cout<<c<<endl;
    }
    else if(ch=='-')
    {
        cin>>a>>b;
        c=a-b;
        cout<<c<<endl;
    }
    else if(ch=='*')
    {
        cin>>a>>b;
        c=a*b;
        cout<<c<<endl;
    }
    else if(ch=='%' && b!=0)
    {
        cin>>a>>b;
        c=a%b;
        cout<<c<<endl;
    }
    else if(ch=='/' && b!=0)
    {
        cin>>a>>b;
        c=a/b;
        cout<<c<<endl;
    }
    else
         cout<<"Invalid operation. Try again."<<endl;
    cin>>ch;
}

return 0;

}

Modified code

Your Mistake
else if(ch==’%’ && b!=0)
you can’t check b before taking input (a and b)
also in the question it is mention that b will never be 0
so just omit this condition

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.