Go: package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
using namespace std;

int main(){
  long a, b;
  long ca, cb, tmp;
  long gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb!=0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a*b/gcd;

    printf("%d %d\n", gcd, lcm);
  }

  return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
	for(long long a, b; scanf("%lld %lld", &a, &b) == 2;) {
		long long g = __gcd(a, b);
		printf("%lld %lld\n", g, a / g * b);
	}

	return EXIT_SUCCESS;
}

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	int i,j;
	
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd <<" " << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

C++: #include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long int a,b,n,lcm;
    while (scanf ("%lld %lld",&a,&b)!=EOF)
    {
        n=__gcd(a,b);
        lcm=(a*b)/n;
        cout<<n<<" "<<lcm<<endl;
    }
}

C++: #include <iostream>
 
typedef unsigned int ui;
 
void swap(ui & a, ui & b)
{
    unsigned int tmp = a;
    a = b;
    b = tmp;
}
 
ui gcd(ui a, ui b)
{
    if (a < b) swap(a, b);
 
    ui c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
 
    return b;
}
 
int main() {
    using namespace std;
 
    ui a, b;
    while (cin >> a >> b) {
        const ui GCD = gcd(a, b);
        const ui LCM = a * (b / GCD);
        cout << GCD << ' ' << LCM << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
int gcd(int x,int y){
	return y==0?x:gcd(y,x%y);
}
int lcm(int x,int y){
	return x/gcd(x,y)*y;
}
signed main(){
	int a,b;
	while(cin>>a>>b){
		cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
	}
}

C++: #include <iostream>			//std::cout, std::cin
#include <string>			//std::string,std::to_string(C++11)
#include <vector>			//std::vector
#include <valarray>			//std::valarray
#include <algorithm>		//std::sort
#include <ctime>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs,std::pow,sqrt,sin,cos,round,floor,ceil
#include <fstream>			//std::ifstream,std::ofstream
#include <iomanip>			//std::setprecision,std::setw,std::setfill
#include <random>			//std::random(C++11)
#include <numeric>			//std::accumulate
#include <functional>		//std::greater
#include <chrono>			//std::chrono(C++11)
#include <bitset>			//std::bitset
#include <queue>			//std::queue

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;

int Greatest_Common_Divisor(int a, int b) {

	while (a != 0 && b != 0) {
		if (a > b) {
			a = a - b;
		}
		else {
			b = b - a;
		}
	}
	return(a + b);
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	//std::ofstream ofs("456.csv");
	//std::chrono::system_clock::time_point t_st = std::chrono::system_clock::now();

	unsigned int a = 0, b = 0;
	std::vector<unsigned int> GCD, LCM;

	while (std::cin >> a) {
		std::cin >> b;
		GCD.push_back(Greatest_Common_Divisor(a, b));
		LCM.push_back(unsigned long long(a)*unsigned long long(b) / GCD.back());
	}

	for (int i = 0; i < GCD.size(); i++) {
		std::cout << GCD[i] << " " << LCM[i] << std::endl;
	}

	//std::chrono::system_clock::time_point t_ed = std::chrono::system_clock::now();
	//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t_ed - t_st).count() << "ms" << std::endl;

}

C++: int main(){
//	m*n = LCM * GCD
	unsigned long long m, n;
	while(cin >> m >> n){
		int LCM, GCD;
		
		if(m<n){
			int swap;
			swap = m;
			m = n;
			n = swap;
		}

		int m_, n_;
		m_ = m;
		n_ = n;
		do {
			if(n_==0){
				GCD = m_;
				break;
			}
			
			int swap = m_ % n_;
			m_ = n_;
			n_ = swap;
		} while(1);
		
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	return 0;
}

C++: #include<stdio.h>
long long fan(long long a,long long b)
{
    if(b==0)
        return a;
    else
        return fan(b,a%b);
}
int main()
{
    long long a,b;
    while(scanf("%lld%lld",&a,&b)!=EOF)
    printf("%lld %lld\n",fan(a,b),a/fan(a,b)*b);
    return 0;
}

C++: import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a,b;
		while(true){
			a = cin.nextInt();
			b = cin.nextInt();
			System.out.println(gcd(a,b)+" "+lcm(a,b));
		}
	}

	private static int gcd(int a, int b) {
		if(b == 0)
			return a;
		else
			return gcd(b,a%b);
	}

	private static int lcm(int a, int b) {
		return a*b/gcd(a,b);
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long r=1;
	while(1){
		r=a%b;
		if(r==0)break;
		a=b;
		b=r;
	}
	return b;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int gcd(int x, int y)
{
	if (x%y == 0)
		return y;
	if (x < y)
		swap(x, y);
	return gcd(y, x%y);
}
int main()
{
	int n, m;
	while (scanf("%d %d", &n, &m)!=EOF);
	{
		cout << gcd(n, m) <<" "<< n / gcd(n,m) * m << endl;
	}
}

C++: #include<iostream>
using namespace std;
long long gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  while(cin>>a>>b){

  c=gcd(a,b);
  d=a*(b/c);
  cout<<c<<' '<<d<<endl;
  }
  return 0;
}

long long gcd(long long x,long long y){
  while(x!=y){
    if(x>y){
      x=x%y;
      if(x==0) return y;
    }
    else{
      y=y%x;
      if(y==0) return x;
    }
  }
  return x;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

long gcd(long a, long b) {
    if(b == 0) return(a);
    return(gcd(b, a % b));
}

long lcm(long m, long n) {
    if(m == 0 || n == 0) return(0);
    return((m * n) / gcd(m, n));
}

int main(void) {
    long a, b;
    while(scanf("%ld %ld", &a, &b) != EOF) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return(0);
}

C++: #include<stdio.h>
#include<math.h>
int main()
{
    unsigned long long int b,a,GCD,LCM,m,temp;
    while(scanf("%llu %llu", &a, &b) != EOF) {
        m = a*b;
        {


        while(b != 0)
        {
            temp = b;
            b = a%b;
            a = temp;
        }
        GCD = a;
      }

    LCM = (m/GCD);

    printf("%llu %llu",GCD, LCM);
     }
    return 0;
}