Why is the code not passing all the test cases?

Write a program that works as a simple calculator.

1.It reads a character (ch)
2.If ch is among ‘+’, ‘-’, ‘*’, ‘/’ or ‘%’ it furthur takes two numbers (N1 and N2 as input). It then performs appropriate appropriate operation between numbers and print the number.
3.If ch is ‘X’ or ‘x’, the program terminates.
4.If ch is any other character, the program should print ‘Invalid operation. Try again.’ and seek inputs again (starting from character).