Generate a pair of integers from a range [ L , R ] whose LCM also lies within the range | Java implementation of the above approach ; Checking if any pair is possible or not in range ( l , r ) ; If not possible print ( - 1 ) ; Print LCM pair ; Driver code ; Function call
import java . util . * ; class GFG { static void lcmpair ( int l , int r ) { int x , y ; x = l ; y = 2 * l ; if ( y > r ) { System . out . print ( "-1NEW_LINE"); } else { System . out . print ( " X ▁ = ▁ " + x + " ▁ Y ▁ = ▁ " + y + "NEW_LINE"); } } public static void main ( String [ ] args ) { int l = 13 , r = 69 ; lcmpair ( l , r ) ; } }