Code is showing wrong output

My code is showing wrong output even though i have applied the same approach as taught in the course.
please check
Thanks

this is my code : https://ide.codingblocks.com/s/609849

Hi… u are not handling all the cases properly… refer to my code https://ide.codingblocks.com/s/609855

Hi… do u still have any doubts???

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.