Why my code is not submiting even after correct answer in compiler

HERE IS THE CODE

hi Hitesh,
ur logic was correct but there was just a small mistake…
u were printing p outside the while loop while u have to print it inside as there can be multiple test cases…
i have corrected ur code… its working fine now https://ide.codingblocks.com/s/641908

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.