human
Program to check if a number is divisible by sum of its digits | Function to check if the given number is divisible by sum of its digits.
Find sum of digits.
check if sum of digits divides n.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to program to check if a number is divisible by sum of its digits and the other steps required.
 def isDivisible ( n ) :
	temp = n
	sum = 0 ;
	while ( n ) :
		k = n % 10 ;
		sum += k ;
		n /= 10 ;
	if ( temp % sum == 0 ) :
		return " YES " ;
	return " NO " ;
n = 123 ;
print ( isDivisible ( n ) ) ;