Unable to solve problem BASIC CALCULATOR

I have tried two approaches to the problem, although they are based on same principle and similar loops and conditions, but are failing the test cases…

I have submitted two solutions as follows:-
Submission #8379165
Submission #8436552

I am unable to figure out the problem in approach.

Hello @gautam74 please share your code by saving it on ide.codingblocks.com .

Both of them failed with TLE

Hello @gautam74 see this corrected code:


if you have any doubt you can ask here:
Happy Learning!!

what does while(true) do ?? Can you elaborate on why my code wan’t working

Hey @gautam74
your code is fine too but the only error is that you are using the OR operator in between the op!=‘x’ or op!=‘X’
if the opt comes out to be x then it is true for the other and in the or even if any condition is true then the whole loop comes true .
so that’s why you have you have to use AND in it.


in the code which i hav given you there i gave you the other option.
but i forgot to gave you this code link.
Happy Learning!!

Thanks for the help!!

@gautam74 if you feel that your doubt is cleared you can mark this as resolved.
Happy Learning!!

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.