Problem basic calculator

import java.util.;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
char c = cin.nextLine().charAt(0);
while(c != ‘x’|| c != ‘X’){
int n1 = cin.nextInt(), n2 = cin.nextInt();
switch©{
case '
’ :
System.out.println(n1*n2);
break;
case ‘/’ :
System.out.println(n1/n2);
break;
case ‘+’ :
System.out.println(n1+n2);
break;
case ‘-’ :
System.out.println(n1-n2);
default:
System.out.println(“Invalid operation. Try again”);
}
c = cin.nextLine().charAt(0);
}
}
}== what’s the error

pls change the scn.nextLine to scn.next()
and 2nd mistake is
when c==‘x’
ur code is taking n1 and n2 from user
but there is no input

so pls correct it
otherwise the approach is fine

hope this will help u

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.