Basic calculator (all test cases error )

You are taking input in the beginning itself. But you have to take input of numbers only if ch is a valid operator. So take input in the cases. Also you have not checked this condition specified in the question :

For division and modulus, 2nd number should not be 0.

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.