human
Count all N digit numbers whose digits are multiple of X | Function to calculate x ^ n using binary - exponentiation.
Stores the resultant power.
Stores the value of x ^ ( n / 2 ).
Function to count aN - digit numbers whose digits are multiples of x.
Count adigits which are multiples of x.
Check if current number is a multiple of X.
Increase count of multiples.
Check if it 's a 1 digit number.
Count the total numbers.
Return the total numbers.
Driver Code.
Given N and X.
Function call"
Solution in Python:
assistant
#Here is code to count all N digit numbers whose digits are multiple of X and the other steps required.
 def power ( x , n ) :
	temp = [ ]
	if ( n == 0 ) :
		return 1
	temp = power ( x , n // 2 )
	if ( n % 2 == 0 ) :
		return temp * temp
	else :
		return x * temp * temp
def count_Total_Numbers ( n , x ) :
	total , multiples = 0 , 0
	for i in range ( 10 ) :
		if ( i % x == 0 ) :
			multiples += 1
	if ( n == 1 ) :
		return multiples
	total = ( ( multiples - 1 ) * power ( multiples , n - 1 ) )
	return total
if __name__ == ' _ _ main _ _ ' :
	N = 1
	X = 3
	print ( count_Total_Numbers ( N , X ) )