Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
long long gcd(long long a,long long b)
{
	if(b==0)   return a;
	return gcd(b,a%b);
}
long long n,m;
int main()
{
    while(cin>>n>>m)
	{
		cout<<gcd(n,m)<<" "<<n*m/gcd(n,m)<<endl;
	}
    return 0;
}

C++: #include<iostream>

#define     MAX_NUMBER         2000000000
#define     __ERROR_CODE__     (-1)

using namespace std;

int Integer_LCM(const unsigned int,const unsigned int);
int Integer_GCD(const unsigned int,const unsigned int);

int main(){
	int a,b;

	while(cin >> a >> b){
		cout << Integer_LCM(a,b) << " " << Integer_GCD(a,b) << endl;
	}

	return 0;
}

int Integer_LCM(const unsigned int a,const unsigned int b){
	int p,q,r;

	// 入力値の確認
	if((a <= 0) || (b <= 0) || (a > ((int)(MAX_NUMBER))) || (b > ((int)(MAX_NUMBER)))){
		return ((int)(__ERROR_CODE__));
	}

	// 変数の初期化
	p = a;
	q = b;
	r = a % b;

	// ユークリッドの互除法
	while (r != 0){
		p = q;
		q = r;
		r = p % q;
	}

	return q;
}

int Integer_GCD(const unsigned int a,const unsigned int b){
	// 入力値の確認
	if((a <= 0) || (b <= 0) || (a > ((int)(MAX_NUMBER))) || (b > ((int)(MAX_NUMBER)))){
		return ((int)(__ERROR_CODE__));
	}

	return ((int)( ((double)a) / Integer_LCM(a,b) )) * b;
}

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

long long int gcd(long long int a,long long int b){
	if(b==0)	return a;
	return gcd(b,a%b);
}
	
int main(){
	long long int a,b,M,N;
	while(cin >> a>>b){
		long long int g = gcd(a,b);
		cout << g << ' ' << a/g*b << endl;
	}
	return 0;
}

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

int gcd(int a, int b){
	int r, tmp;

	if(a == 0 || b == 0){
		return 0;
	}

	if(a < b){
			tmp = a;
			a = b;
			b = tmp;
		}

		r =  a % b;
		while(r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		return b;
}

int lcm(int a, int b){
	if(a == 0 || b == 0){
		return 0;
	}

	return (a * b/ gcd(a,b));
}

int main(){
	int a, b, r;
	int lcm_num, gcd_num;
	while(cin >> a >> b){
		gcd_num = gcd(a, b);
		lcm_num = lcm(a, b);
		cout << gcd_num << " " << lcm_num << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
    int a,b,lcm=0,r,x,y,count=0;
    while(cin>>a>>b){
        count++;
        if(count==50)break;
        x=a;
        y=b;
        while(1){
        r=a%b;
        a=b;
        b=r;
        if(r==0)break;
        }
        lcm=a;
    cout<<lcm<<" "<<x*y/lcm<<endl;
}
}

C++: // ConsoleApplication17.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include "iostream"

using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << a << " " << a << endl;
		}
	}
	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

long long gcd(long long b, long long c) {
	long long r = b%c;
	if (r == 0) return b;
	else
	{
		return gcd(b, r);
	}
}

int main() {
	long long a[2];
	long long tmp;
	long long GCD = 1;
	long long LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		GCD = gcd(a[0], a[1]);

		// ????°???¬?????°????¨????
		LCM = a[0] * a[1] / GCD;

		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int max(long long a,long long b)
{
    if(a>=b)
    return 1;
    else
    return 0;
}
int main()
{
    long long x,y,t,gcd,lcm,a,b;
    while(scanf("%lld%lld",&x,&y)!=EOF)
    {
        if(!max(x,y))
        {
            t=x;x=y;y=t;
        }
        a=x;
        b=y;
        while(x%y)
        {
            x=x%y;
            if(!max(x,y))
        {
            t=x;x=y;y=t;
        }
        }
        gcd=y;
        lcm=a/gcd;
        lcm=lcm*b;
        cout<<gcd<<' '<<lcm<<endl;
    }
    return 0;
}

C++: #include <iostream>

int main(){

	int a, b;

	while(std::cin >> a >> b){

		long int minmul; //least common multiple
		int maxdivi = 1; //greatest common divisor
		int small;

		if(a > b)
			small = b;
		else
			small = a;

		for(int i = 2; i <= small; ++i){
			if(a % i == 0  &&  b % i == 0){
				maxdivi = maxdivi * i;
				i = 2;
			}
		}
		minmul = a * b / maxdivi;

	std::cout << maxdivi << " " << minmul << std::endl;

	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL gcd(LL a,LL b){
   if(a>b)return gcd(b,a);
   if(b%a==0)return a;
   return gcd(b%a,a);
}
int main(){
        LL a,b;
        while(cin>>a,cin>>b){
	      LL g=gcd(a,b);
	      cout<<g<<" "<<a/g*b<<endl;;
        }
	return(0);
}

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d, r, s, h;

	while (cin >> a >> b){
		//c
		h = a;
		s = b;
		for (;;){
			r = h % s;
			if (r == 0) {
				c = s;
				break;
			}
			h = s;
			s = r;
		}
		//d
		h = a;
		s = b;
		if (a < b){
			for (;;){
				if ((b % a) == 0){
					d = b;
					break;
				}
				b = b + s;
			}
		}
		else if (a >= b){
			for (;;){
				if ((a % b) == 0){
					d = a;
					break;
				}
				a = a + h;
			}
		}

		cout << c << ' ' << d << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(b == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if (a > b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a / B) * b;
    cout << B << " " << min << endl;
  }
  else if(a == b){
    cout << a << " " << a << endl;
  }

 }
 return 0; 
}