Regarding optimisation of a program

There is a program in which I have to find value of x for (x^k=n) but compiler is giving me time limit exceeded error.
Can you please help me how to optimize the code?

hello @sarthak_singhal
use long long in place of int and then try

https://ide.codingblocks.com/s/451601 I have made the changes but now compiler is giving wrong answer.

check now->

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.