Basic calculator testcase0 only failed other 1,2,3 passed , please help

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc1 = new Scanner(System.in);

      do {
        char operation = sc1.next().charAt(0);
        if (operation == 'x' || operation == 'X') {
            break;
        } else if (operation != '+' && operation != '-' && operation != '*' && operation != '/' && operation != '%') {
            System.out.println("Invalid operation. Try again.");
        } else {
            long n1 = sc1.nextInt();
            long n2 = sc1.nextInt();
            if (n1 > 0 && n2 > 0 && n1 <= 1000000000 && n2 <= 1000000000) {
                long ans = 0;
                if (operation == '+') {
                    ans = n1 + n2;
                    System.out.println(ans);
                } else if (operation == '*') {
                    ans = n1 * n2;
                    System.out.println(ans);
                } else if (operation == '-') {
                    ans = n1 - n2;
                    System.out.println(ans);
                } else if (operation == '/') {
                    if (n1 > n2) {
                        ans = n1 / n2;
                        System.out.println(ans);
                    }
                } else if (operation == '%') {
                    ans = n1 % n2;
                    System.out.println(ans);
                } else {
                    System.out.println("Invalid operation. Try again.");
                }
            }
        }
    } while (true);
}

}

can someone please help

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.

Hi where you clear the doubts , I think you forget to press enter

Hey @vivek4988_7c34775e05f479ae You code is failing test case
+
1
2

1
2
*
1
2
.
/
1
2
x
Expected output =
3
-1
2
Invalid operation. Try again.
0
Your Output :
3
-1
2
Invalid operation. Try again.
//Zero is missing

oops thanks , I removed division condition if n1 > n2 and works thanks

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.