Check the balanced parenthesis?


what is the problem in the above code it does not produce the right output??

Your found was 1 at the time of initialization as well. So it always produces the output “not balanced”.
I modified your code. Check it out -