Recursive Implementation of atoi ( ) | Recursive function to compute atoi ( ) ; base case , we 've hit the end of the string,  we just return the last value ; If more than 1 digits , recur for ( n - 1 ) , multiplu result with 10 and add last digit ; Driver Code
def myAtoiRecursive ( string , num ) : NEW_LINE INDENT if len ( string ) == 1 : NEW_LINE INDENT return int ( string ) + ( num * 10 ) NEW_LINE DEDENT num = int ( string [ 0 : 1 ] ) + ( num * 10 ) NEW_LINE return myAtoiRecursive ( string [ 1 : ] , num ) NEW_LINE DEDENT string = "112" NEW_LINE print ( myAtoiRecursive ( string , 0 ) ) NEW_LINE