View Code of Problem 59

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        int temp;
        int ji = m*n;
        while (n > 0) {
            temp = m%n;
            m=n;
            n=temp;
        }
        System.out.println(ji/m+" "+m);
    }
}

Double click to view unformatted code.


Back to problem 59