Program to check if a number is divisible by any of its digits | Python implementation of above approach ; Converting integer to string ; Traversing the string ; If the number is divisible by digits then return yes ; If no digits are dividing the number then return no ; Driver Code ; passing this number to get result function
def getResult ( n ) : NEW_LINE INDENT st = str ( n ) NEW_LINE for i in st : NEW_LINE INDENT if ( n % int ( i ) == 0 ) : NEW_LINE INDENT return ' Yes ' NEW_LINE DEDENT DEDENT return ' No ' NEW_LINE DEDENT n = 9876543 NEW_LINE print ( getResult ( n ) ) NEW_LINE