Find two distinct numbers such that their LCM lies in given range | Java program for the above approach ; Function to find two distinct numbers X and Y s . t . their LCM lies between L and R and X , Y are minimum possible ; Check if 2 * L lies in range L , R ; Print the answer ; Driver Code ; Given value of ranges ; Function call
import java . io . * ; class GFG { static void answer ( int L , int R ) { if ( 2 * L <= R ) System . out . println ( L + " , ▁ " + ( 2 * L ) ) ; else System . out . println ( " - 1" ) ; } public static void main ( String [ ] args ) { int L = 3 , R = 8 ; answer ( L , R ) ; } }