Chewbacca Problem

Please let me know why is test case 2 and 4 failing

for input n = 9000
your Output is 0
but correct output is 9000

if(remainder==9 && i==1)
        d=remainder;

this condition is not correct because at leftmost digit i is not 1
i is one at leftmost digit

update this condition

Modified Code

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.