human
Check if the sum of digits of number is divisible by all of its digits | Python implementation of above approach.
Converting integer to string.
Initialising sum to 0.
Traversing through the string.
Converting character to int.
Comparing number and sum Traversing again.
Check if any digit is not dividing the sum.
Return false.
If any value is not returned then all the digits are dividing the sum SO return true.
Driver Code.
passing this number to get result function"
How can the above be solved in Python?
assistant
#Here is code to check if the sum of digits of number is divisible by all of its digits and the other steps required.
 def getResult ( n ) :
	st = str ( n )
	sum = 0
	length = len ( st )
	for i in st :
		sum = sum + int ( i )
	for i in st :
		if ( sum % int ( i ) != 0 ) :
			return ' No '
	return ' Yes '
n = 123
print ( getResult ( n ) )