human
Count of pairs in given range having their ratio equal to ratio of product of their digits | Function to find the product of digits of the given number.
Function to find the count of pairs ( a , b ) such that a : b = ( product ofdigits of a ) : ( product of digits of b ).
Stores the count of the valid pairs.
Loop to iterate over all unordered pairs ( a , b ).
Stores the product of digits of a.
Stores the product of digits of b.
If x != 0 and y != 0 and a : b is equivalent to x : y.
Increment valid pair count.
Return Answer.
Driver code.
Function Call"
Solution in Python:
 Write me a code to count of pairs in given range having their ratio equal to ratio of product of their digits and the other steps required?
assistant
#Here is code to count of pairs in given range having their ratio equal to ratio of product of their digits and the other steps required.
 def getProduct ( n ) :
	product = 1
	while ( n != 0 ) :
		product = product * ( n % 10 )
		n = n // 10
	return product
def countPairs ( L , R ) :
	cntPair = 0
	for a in range ( L , R + 1 , 1 ) :
		for b in range ( a + 1 , R + 1 , 1 ) :
			x = getProduct ( a )
			y = getProduct ( b )
			if ( x and y and ( a * y ) == ( b * x ) ) :
				cntPair += 1
	return cntPair
if __name__ == ' _ _ main _ _ ' :
	L = 1
	R = 100
	print ( countPairs ( 1 , 100 ) )