Why this error come?

when i write
long ans=pow(mid,k);
if(ans>n)

then
this error come
runguard: warning: timelimit exceeded (wall time): aborting command
runguard: warning: command terminated with signal 15

but when i do this
if(pow(mid,k)>n)
then no error come

@Adityakumar3112 could you provide the complete code in Coding blocks IDE

@Adityakumar3112 pow() function return double, long double or float, so use long double to store the value, it will not cause any error. Error occurs because range of double is more then range of long, also if pow return 10.01 or something casting it would cause us to loose 0.01 which can lead to infinite loop in some situations as
10.01<=10 is false but 10<=10 is true.

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.