Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

func getGCD(a, b int) int {
	if b == 0 {
		return a
	}
	return getGCD(b, a%b)
}

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


ll a, b;

main(){
	while(cin >> a >> b){
		cout << __gcd(a, b) << " " << a/__gcd(a, b)*b << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;


int gcd(int a,int b){
    if(b>0) return gcd(b,a%b);
    else return a;
    }
    
    int lcm(int a,int b){
    return ((a/gcd(a,b))*b);
    }
    
    int main(){
    // Here your code !
            int a,b;
    while(cin>>a>>b){

        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
#include<vector>
using namespace std;
long long gcd(long long a,long long b)
{
    if(b==0)
		return a;
    else return gcd(b,a%b);
}
long long lcm(long long a,long long b)
{
	return a*b/gcd(a,b);
}
int main()
{
    long long a,b;
    while(scanf("%I64d%I64d",&a,&b)!=EOF)
	{
		printf("%I64d %I64d",gcd(a,b),lcm(a,b));
	}
    return 0;
}

C++: #include"iostream"
using namespace std;

int main()
{
	int a,b,gcd,lcm;
	while (1)
	{
		cin >> a >> b;
		if (a == EOF)
			break;
		for (int i = a; i > 0; i--)
		{
			if (b%i == 0&&a%i==0)
			{
				gcd = i;
				break;
			}
		}
		for (int j = a;; j++)
		{
			if (j%a == 0 && j%b == 0)
			{
				lcm = j;
				break;
			}
		}
		cout << gcd << " " << lcm << endl;
	}
    return 0;
}

C++: #include<stdio.h>


//公約数の関数
int kouyakusuu_f(unsigned long long int a,unsigned long long int b)
{
	//返す変数
	unsigned long long int kouyakusuu_ans = 0;

	//無限ループ
	for (unsigned long long int i = a;;i -= 2)
	{
		//両方割れるなら
		if (a %i == 0)
		{
			if (b % i == 0)
			{
				kouyakusuu_ans = i;
				break;
			}
		}
	}

	return kouyakusuu_ans;
}



//公倍数の関数
unsigned long long int koubaisuu_f(unsigned long long int a,unsigned long long int b)
{
	//保存用変数(aとbをもう入れちゃう)
	unsigned long long int hozon1 = a,hozon2 = b;
	//インクリメント変数
	int count1 = 0,count2 = 0;

	//合うまで続ける
	while (hozon1 != hozon2)
	{
		//aのほうが小さいとき(bが大きい)
		while (hozon1 < hozon2)
		{
			count1++;
			//小さいaを少しずつ増やす
			hozon1 = a * count1;
		}
		//bの方が小さいとき(aが大きい)
		while (hozon2 < hozon1)
		{
			count2++;
			//小さいbを少しずつ増やす
			hozon2 = b * count2;
		}
	}

	//どうせ同じだからどっちでも問題ない
	return hozon1;
}




int main(void)
{
	//公倍数と公約数
	unsigned long long int kouyakusuu = 0;
	unsigned long long int koubaisuu = 0;
	//入力
	unsigned long long int a = 0,b = 0;

	//回しまくる
	while (scanf("%d %d",&a,&b) != EOF)
	{
		//同じ値ならそのマンまでいいでしょう
		if (a != b)
		{
			//公約数を関数よりもとめる
			kouyakusuu = kouyakusuu_f(a,b);
			//公倍数を関数により求める
			koubaisuu = koubaisuu_f(a,b);
		}
		//同じ値ならそのまま
		else
		{
			koubaisuu = a;
			kouyakusuu = a;
		}
		//表示
		printf("%llu %llu\n",kouyakusuu,koubaisuu);
	}

	return 0;
}

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

int main(){
while(true){
   int a = -1;int b = 0;int i = 1;int g = 0;int seki = 1;
	   cin >> a >> b;
          seki = a*b;
	if(a == -1){
		break;
		}
	if(a < b){
		i=a;
		a=b;
		b=i;
		}
for(i = 1;i <= 50;i++){
   
if(b == 1){
  g = a;
  break;
  }
else {
 a = a%b;
 i=a;
 a=b;
 b=i;
 }
}
cout >> g >> " " >> seki/g >> endl;
}
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

LL gcd(LL m, LL n)
{
	if ((0 == m) || (0 == n)) return 0;

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

LL lcm(LL m, LL n)
{
	if ((0 == m) || (0 == n)) return 0;

	return ((m / gcd(m, n)) * n);
}

//================================================
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	LL A, B;
	while (cin >> A >> B) {
		if (A < B) {
			A = B;
			B = A;
		}
		cout << gcd(A, B) << " " << lcm(A, B) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>

using namespace std;

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

int main() {
    int a, b;
    int ma, mi;
    while(cin >> a >> b) {
        if(a < b) {
            swap(a, b);
        }
        ma = gcd(a,b);
        mi = ma * (a / ma) * (b / ma);
        cout << ma << ' ' << mi << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>     //by  @山?叶??     A
#include<cstdlib>
#include<cmath>
#include<string>
#include<set>
#include<sstream>
using namespace std;
typedef long long ll;
double dinf=99999999.9, mm=1e-8;
const int N=10008,inf=0x3f3f3f3f;
ll gcd(ll x,ll y)
{
    if(x%y==0)
        return y;
    else
        return gcd(y,x%y);
}
int main()
{
    ll a,b;
    while(scanf("%lld%lld",&a,&b)!=EOF)
    {
        printf("%lld ",gcd(a,b));
        ll k,ans=1;
        while(k=gcd(a,b),k!=1)
        {
           ans*=k;
           a/=k;b/=k;
        }
        ans=ans*a*b;
        printf("%lld\n",ans);
    }

    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  long long int a,b;
  long long int temp,con;
  long long int hk1,hk2;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    if(a>b){
      if(a%b==0){
	hk1=b;
      }else{
	long long int bit=b/2;
	for(long long int i=bit;i>0;i--){
	  if(a%i==0 && b%i==0){
	    hk1=i;
	    break;
	  }
	}
      }
    }else{
      if(b%a==0){
	hk1=a;
      }else{
	long long int dot=a/2;
	for(long long int i=dot;i>0;i--){
	  if(a%i==0 && b%i==0){
	    hk1=i;
	    break;
	  }
	}
      }
    }
    temp=a*b;
    con=temp/hk1;
    hk2=con;
    printf("%lld %lld\n",hk1,hk2);
  }
  return 0;
}