Find a distinct pair ( x , y ) in given range such that x divides y | JavaScript implementation of the approach ; Driver code
function findpair ( l , r ) { let c = 0 ; for ( let i = l ; i <= r ; i ++ ) { for ( let j = i + 1 ; j <= r ; j ++ ) { if ( j % i == 0 && j != i ) { document . write ( i + " " + j + " " ) ; c = 1 ; break ; } } if ( c == 1 ) break ; } } let l = 1 , r = 10 ; findpair ( l , r ) ;