Can you please tell me where i am going wrong

you forgot to take input (t and n) :smile:

modified code

oh!! and can you please tell me when do we get this error?

when you stuck in infinite loop
as you have not taken n
so n can be any number may be negative so it may stuck in loop

garbage in garbage out

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.