Count of numbers in a range that does not contain the digit M and which is divisible by M . | Function to count all the numbers which does not contain the digit ' M ' and is divisible by M ; Storing all the distinct digits of a number ; Checking if the two conditions are satisfied or not ; Lower Range ; Upper Range ; The digit
function contain ( L , U , M ) { let count = 0 ; for ( let j = L ; j < U ; j ++ ) { let num = new Set ( ) ; let str = String ( j ) ; num . add ( str ) ; if ( j % M == 0 && ! num . has ( String ( M ) ) ) { count += 1 ; } } document . write ( count - 2 ) ; } let L = 106 ; let U = 200 ; let M = 7 ; contain ( L , U , M ) ;