Pairs with GCD equal to one in the given range | Function to print all pairs ; check if even ; We can print all adjacent pairs for ( i = l ; i < r ; i += 2 ) { document . write ( " { " + i + " , ▁ " + i + 1 + " ] , ▁ " ) ; } ; Driver Code
function checkPairs ( l , r ) { if ( ( l - r ) % 2 == 0 ) return false ; return true ; } var l = 1 , r = 8 ; if ( checkPairs ( l , r ) ) document . write ( " " ) ; else document . write ( " " ) ;