Find N digits number which is divisible by D | Function to return N digits number which is divisible by D ; to store answer ; Driver code
function findNumber ( n , d ) { let ans = " " ; if ( d != 10 ) { ans += ( d ) . toString ( ) ; for ( let i = 1 ; i < n ; i ++ ) ans += ' ' ; } else { if ( n == 1 ) ans += " " ; else { ans += ' ' ; for ( let i = 1 ; i < n ; i ++ ) ans += ' ' ; } } return ans ; } let n = 12 , d = 3 ; document . write ( findNumber ( n , d ) ) ;