Program to check if a number is divisible by any of its digits | C # implementation of above approach ; Function to check if given number is divisible by any of its digits ; check if any of digit divides n ; check if K divides N ; Driver Code
using System ; class GFG { static String isDivisible ( int n ) { int temp = n ; while ( n > 0 ) { int k = n % 10 ; if ( temp % k == 0 ) { return " YES " ; } n /= 10 ; } return " NO " ; } public static void Main ( String [ ] args ) { int n = 9876543 ; Console . WriteLine ( isDivisible ( n ) ) ; } }