View Code of Problem 59

import java.util.Scanner;

public class Main
{
  public static void main(String[] args)
  {
    Scanner scan=new Scanner(System.in);
    int a=scan.nextInt();
    int b=scan.nextInt();
    
    int max=0;
    int min=0;
    
    int c=0;
    
    while(b%a!=0)
    {
      c=b%a;
       b=a;
      a=c;
     
    }
   max=c;
    min=a*b/max;
    
    System.out.print(min+" "+max);
    
    
  }
}

Double click to view unformatted code.


Back to problem 59