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 <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

bool is_prime(int n)
{
    if(n<=1)
        return false;
    for(int i=2; i*i<=n; i++){
        if(n%i==0)
            return false;
    }
    return true;
}

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

    return gcd(b, a%b);
}

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

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

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			int s;
			s = a;
			a = b;
			b = s;
		}

		for(; b != 0;){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}

C++: #include <iostream>
using namespace std;
float LCM(float a,float b)
{
	if(a==b)
	return a;
	else
	{
		if(a>b)
		a-=b;
		else
		b-=a;
		LCM(a,b);
	}
}
int main()
{
	float a,b;
	long c;
	cin>>a>>b;
	while(a!=EOF||b!=EOF)
	{
		c=LCM(a,b);
		if(c>100000)
			cout<<c/10000<<"0000 "<<(a*b/c)/10000<<"0000"<<endl;
		else if((a*b/c)>100000)
			cout<<c<<" "<<(a*b/c)/10000<<"0000"<<endl;
		else
			cout<<c<<" "<<(a*b/c)<<endl;
		cin>>a>>b;
	}
}

C++: #include<iostream>
using namespace std;
int lcm(long long x,long long y);
int gcd(long long x,long long y);
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<lcm(a,b)<<" "<<gcd(a,b)<<endl;
    }

    return 0;
}
int lcm(long long x,long long y)
{
    long long a,i;
    if(x>y) a=y;
    else a=x;
    for(i=a;i>0;i--)
    {
        if(x%i==0 && y%i==0)
        {
            return i;
            break;
        }
    }


}
int gcd(long long x,long long y)
{
    return ((x*y)/lcm(x,y));

}

C++: #include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  scanf("%d%d",&a,&b);
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);


  return 0;
}

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

int main() {
	// your code goes here
	long long a,b;
	long long r;
	long long gcd, lcm;
	while(cin>>a>>b){
		if(a<b){swap(a,b);}
		
		long long c=a , d=b;
		while(true){
		r=c%d;
		if(r==0)gcd=d; break;
		c=d; d=r;
		
		}

	lcm= a*b / lcm;
	
	
	cout << gcd << " " << lcm << endl;	
	}
	return 0;
	
	
}

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

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

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


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

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long pow_mod(long long n,long long k,long long m){
    if (k == 0){
        return 1;
    } else if (k % 2 == 1){
        return pow_mod(n,k-1,m)*n % m;
    } else {
        long long t = pow_mod(n,k/2,m);
        return t*t % m;
    }
}

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
    long long a,b;
    while(cin >> a >> b){
        cout << GCD(max(a,b),min(a,b)) << " " << LCM(max(a,b),min(a,b)) << endl;
    }
}

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d,r,s,h;
	for (cin >> a >> b){
		//c
		h = a;
		s = b; {
			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++: /*
http://blog.csdn.net/liuke19950717
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int gcd(int a,int b)
{
	if(!b)
	{
		return a;
	}
	return gcd(b,a%b);
}
int main()
{
	int n,m;
	while(~scanf("%d%d",&n,&m))
	{
		int tp=gcd(n,m);
		printf("%d %d\n",tp,n/tp*m);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int a,n;
  cin>>a>>n;
  cout<<gcd(a,n)<<" "<<lcm(a,n)<<endl;
  
}

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

long int Gcm(long int a,long int b){

    long int temp=0;
    long int r=1;
    //aとbの最大公約数を求める
    //a,b入力を行う（a>b）。a=b*q+rの形で計算していく
    //b%rの値が０になったときのbがa,bの最大公約数(cとする)となる
    //最小公倍数は、c*a'=a,c*b'=bを満たすa',b'とcとの積である
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r = a%b;
        a = b;
        b = r;//aが最大公約数
    }
    return a;
}

int main(){
    long int x,y;
    long int gcd,lcm;

    while(cin >> x >> y){

    gcd = Gcm(x,y);

    x = x/gcd;
    y = y/gcd;

    lcm = x * y * gcd;

    cout << gcd <<" "<< lcm << endl;
    }
    return 0;
}