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;
    
    for(int i=a;;i--)
    {
      if(a%i==0&&b%i==0)
      {
        break;
      }
   
    }
    max=i;
    min=a*b/max;
    
    System.out.print(min+" "+max);
    
    
  }
}
/*
Main.java:22: error: cannot find symbol
    max=i;
        ^
  symbol:   variable i
  location: class Main
1 error
*/

Double click to view unformatted code.


Back to problem 59