human
Give me a code to count of numbers from the range [ L , R ] which contains at least one digit that divides K and the other steps required given the following:
Count of numbers from the range [ L , R ] which contains at least one digit that divides K | Function that returns true if num contains at least one digit that divides k.
Get the last digit.
If the digit is non - zero and it divides k.
Remove the last digit.
There is no digit in num that divides k.
Function to return the required count of elements from the given range which contain at least one digit that divides k.
To store the result.
For every number from the range.
If any digit of the current number divides k.
Driver code"
Solution in Python:
assistant
#Here is code to count of numbers from the range [ L , R ] which contains at least one digit that divides K and the other steps required.
 def digitDividesK ( num , k ) :
	while ( num ) :
		d = num % 10
		if ( d != 0 and k % d == 0 ) :
			return True
		num = num // 10
	return False
def findCount ( l , r , k ) :
	count = 0
	for i in range ( l , r + 1 ) :
		if ( digitDividesK ( i , k ) ) :
			count += 1
	return count
l = 20
r = 35
k = 45
print ( findCount ( l , r , k ) )