human
Count of prime digits of a Number which divides the number | Function to find the number of digits in number which divides the number and is also a prime number.
Only 2 , 3 , 5 and 7 are prime one - digit number.
Loop to compute all the digits of the number untill it is not equal to the zero.
Fetching each digit of the number.
Checking if digit is greater than 0 and can divides n and is prime too.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to count of prime digits of a Number which divides the number and the other steps required.
 def countDigit ( n ) :
	prime = [ False ] * 10
	prime [ 2 ] = True
	prime [ 3 ] = True ;
	prime [ 5 ] = True
	prime [ 7 ] = True ;
	temp = n
	count = 0 ;
	while ( temp != 0 ) :
		d = temp % 10 ;
		temp //= 10 ;
		if ( d > 0 and n % d == 0 and prime [ d ] ) :
			count += 1
	return count
n = 1032
print ( countDigit ( n ) )