Number of digits before the decimal point in the division of two numbers | Python3 implementation of the approach ; Function to return the number of digits before the decimal in a / b ; Return the required count of digits ; Driver code
import math NEW_LINE def countDigits ( a , b ) : NEW_LINE INDENT return math . floor ( math . log10 ( abs ( a ) ) - math . log10 ( abs ( b ) ) ) + 1 NEW_LINE DEDENT a = 100 NEW_LINE b = 10 NEW_LINE print ( countDigits ( a , b ) ) NEW_LINE