Last digit of Product of two Large or Small numbers ( a * b ) | Function to print the last digit of product a * b ; Driver code
def lastDigit ( a , b ) : NEW_LINE INDENT lastDig = ( ( int ( a [ len ( a ) - 1 ] ) - int ( '0' ) ) * ( int ( b [ len ( b ) - 1 ] ) - int ( '0' ) ) ) NEW_LINE print ( lastDig % 10 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a , b = "1234567891233" , "1234567891233156" NEW_LINE lastDigit ( a , b ) NEW_LINE DEDENT