How to convert string to Interger using recursion?

I tried this but i want to print the whole ans at once.

@POORVI_SAXENA yes you can easily do that, make a global variable.
and for every recursive call do, ans = ans*10 + (str[n]-48);
And just print ans at after the recursive call.

Feel free to ask if you need any furthur help in implementing this.

If you are able to solve it now then please mark it as resolved.

1 Like

@POORVI_SAXENA if your doubt is solved, then please mark this as resolved.

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.