Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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

int main(){
	int x[3], k = 1, a, b;
	
	while(cin >>x[1]>>x[2]){
		if(x[2] > x[1]) swap(x[1], x[2]);
		a = x[1];
		b = x[2];
		while(x[3 - k] != 0){
			x[k] = x[k] % x[3 - k];
			k = 3 - k;
		}
		cout <<x[k]<<" "<<a / x[k] * b<<endl;
		k = 1;
	}
	
	return 0;
}

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 gcd(j, i%j);
	}else{
		return i;
	}
	
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;x=x-y;}
  else if(x==y){break;}
  else if(x==0)break;
  else if(y==0)break;
  else{x=x-y;y=y-x;}
}
L=(a*b)/x;
cout<<y<<" "<<L<<endl;
}
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int gcd(int a, int b){
    if(b==0)
    return a;

    return gcd(b, a%b);
}

int main(){
    while(true){
        int a,b;
        cin>>a>>b;
        if(cin.eof())
        break;
        int g = gcd(a,b);
        cout << g << ' ' << a/g*b << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <algorithm>
using std::__gcd;
int main(){
	int x,y;
	while( scanf("%d %d",&x,&y) != EOF ){
		int g = __gcd(x,y);
		printf("%d %d\n",g,x/g*y);
	}
	return 0;	
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<utility>
#include<sstream>
#define mem0(x) memset(x,0,sizeof x)
#define mem1(x) memset(x,-1,sizeof x)
#define dbug cout<<"here"<<endl;
//#define LOCAL

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e6+10;
const int MOD = 1000000007;

ull n,m;

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

int main(){
    #ifdef LOCAL
        freopen("C:\\Users\\asus-z\\Desktop\\input.txt","r",stdin);
        freopen("C:\\Users\\asus-z\\Desktop\\output.txt","w",stdout);
    #endif
    while(cin >> n >> m){
        ull tmp = gcd(n, m);
        cout << tmp << " " << n*m/tmp << endl;
    }
    return 0;
}

C++: #include <stdio.h>
using namespace std;

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 * num2 / (double)gcd(num1, num2);
}

int main() {
	long a, b;
	while (~scanf("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),(long)lcm(a,b));
	}
}

C++: #include <iostream>
using namespace std;
long GCDr(long m, long n) {
	int r;
	if (m < n) {
		swap(m, n);
	}
	while (n > 0) {
		r = m % n;
		m = n;
		n = r;
	}
	return m;
}
int main() {
	long long a, b;
	while (cin >> a >> b) {
		long long GCD, LCM;
		if (a == b) {
			//a=b??????????????????
			GCD = a;
			LCM = a;
		}
		else {
			GCD = GCDr(a, b);
		}
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

C++: #include <stdio.h>

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

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

int main(void)
{
    int a, b;

    while (scanf("%d %d", &a, &b) != EOF){
        printf("%d %d\n", gcd(a, b), lcm(a, b));
    }

    return (0);
}

C++: #include<bits/stdc++.h>
using namespace std;

// https://onlinejudge.u-aizu.ac.jp/problems/0005
// 正の整数 a,b を入力し、a と b の最大公約数と最小公倍数を出力するプログラムを作成して下さい。

// aとbの最大公約数を返す
int64_t euclid(int64_t a, int64_t b);

int main(){
	// 0 < a,b ≤ 2,000,000,000
	// a と b の最小公倍数は 2,000,000,000 を超えない。
	int64_t a, b;
	
	// 複数のデータセットが与えられる(入力の最後まで処理)
	while(cin>>a>>b){
		// 最大公約数（greatest common divisor）
		int64_t gcd = euclid(a,b);
		
		// 最小公倍数（least common multiple）
		// 　a×b/(aとbの最大公約数)で求まる。
		//  ただしa×bを先に計算するとオーバーフローする可能性があるので注意
		int64_t lcm = a/gcd * b;
		
		cout << gcd <<" "<< lcm <<endl;;
	}
}


// ユークリッドの互除法で最大公約数を求める
int64_t euclid(const int64_t a, const int64_t b){
	return a%b == 0 ? b : euclid(b, a%b);
}

C++: /*
Á·Ï°Ìâ£ºGCD and LCM_AOJ 0005
	´ËÌâÍØÕ¹ÁËLCM(the least common multiple)µÄÇó·¨¡£ 
*/ 

#include <cstdio>
#include <iostream>
using namespace std;

long long a, b;

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

int main()
{
	while(scanf("%lld%lld", &a, &b)!=EOF)
	{
		long long g=gcd(a, b);
		printf("%lld ", g);
		printf("%lld\n", a/g*b);//×¢ÒâÕâÀïÏÈ×ö³ý·¨£¡ 
		
	}
	
	return 0;
}

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

int gcd(int m, int n) {
  while (m != n) {
    if (m > n) {
      m = m - n;
    } else {
      n = n - m;
    }
  }
  return m;
}

int lcm(int m, int n) {
  return (m / gcd(m, n)) * n;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int a, b;

  while (cin >> a, cin >> b) {
    cout << gcd(a, b) << " " << lcm(a, b) << endl;
  }

  return 0;
}

C++: void printFunc(int a,int b,int c,int d,int e,int f);
long gcd(long a,long b);

int main(){
  long a = 0,b = 0;

  while(fscanf(stdin,"%d %d",&a,&b) != EOF){
    printf("%d %d",gcd(a,b),a*b/gcd(a,b));
  }

  return 0;
}

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

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

int gcd(int a, int b) {
    int r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int a, b;
    while (cin >> a >> b) {
        int GCD = gcd(a, b);
        int LCM = a / GCD * b;
        cout << GCD << " " << LCM << endl;
    }
    return 0;
}

C++: #include<iostream>

int gcd( int a, int b )
{
	if( b == 0 )
		return a;

	return gcd( b, a % b );
}

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

int main(){
	int x,y;
	while( std::cin>>x>>y )
		std::cout<<gcd(x,y)<<' '<<lcm(x,y)<<std::endl;

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d", 0, 0);
    } else {
      printf("%d %d", a * b / m, m);
    }
  }
  return 0;
}