Lucky number issue

the above is the code for the lucky number where is the issue the code is not giving error? also please tell whether i have written the time complexity right for the above code?

the gfg link for the question is provided in the given link https://ide.codingblocks.com/s/288370

@Rj.25 what is the issue that you are facing?

the 1 and 0 are printed infinitely and also in cb its showing segementation fault

mam the code is working fine now . i found my mistake. but i have a doubt on time complexity is the time complexity O (n) for the approach used oor it is lesser? please write

@Rj.25 can you share the updated code?

https://ide.codingblocks.com/s/289776 this is the uploaded code

hi @Rj.25 yes its working in O(n) time. Good work :+1:

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.