Program to check if a number is divisible by any of its digits | C # implementation of above approach ; Converting integer to string ; Traversing the string ; find the actual digit ; 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
using System ; public class GFG { static String getResult ( int n ) { string st = n . ToString ( ) ; for ( int i = 0 ; i < st . Length ; i ++ ) { int d = st [ i ] - 48 ; if ( n % d == 0 ) { return " Yes " ; } } return " No " ; } public static void Main ( String [ ] args ) { int n = 9876543 ; Console . Write ( getResult ( n ) ) ; } }