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>

int gcd(int a, int b){
    if(a == b)
        return a;
    else if(a > b)
        a -= b;
    else if(a < b)
        b -= a;
    return gcd(a, b);
}

int lcm(int a, int b){

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

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

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#define MAX 50000
using namespace std;

int p[MAX];

int main()
{
	//素数
	fill(p, p + MAX, 1);
	for (int i = 2; i < MAX; i++){
		int sqrti = (int)sqrt(i);
		for (int j = 2; j <= sqrti; j++){
			if (i % j == 0){
				p[i] = 0;
				break;
			}
		}
	}

	int a, b;
	while (cin >> a >> b){
		int gcm = 1;
		bool flag = true;
		while (flag){
			for (int i = 2;; i++){
				if (p[i] == 1 && a % i == 0 && b % i == 0){
					gcm = gcm * i;
					a = a / i;
					b = b / i;
					break;
				}
				if (i == min(a, b)){
					flag = false;
					break;
				}
			}
		}
		int lcm = gcm * a * b;
		cout << gcm << " " << lcm << endl;
	}
	return 0;
}

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

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, s, t;
	
	while(cin >> a >> b){
		for(int i = (a > b)? b : a; i >= 1; i--){
			if(b%i == 0 && a%i == 0){
				break;
			}
		}
		s = a;
		t = b;
		while(s != t){
			if(s > t){
				while(s > t){
					t += b;
				}
			} else {
				while(t > s){
					s += a;
				}
			}
		}
		cout << i << " " << s << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,i,ii,iii,maxkouyakusuu=0,lowkoubaisuu=2000000000;
while(i>50){
cin>>a>>b;
for(ii=0;ii<a*b;++ii){
  if(a%ii==0 && b%ii==0 && ii>maxkouyakusuu){
    maxkouyakusuu=ii;
  }
for(iii=0;iii<a*b;++iii){
  if(iii%a==0 && iii%b==0 && iii<lowkoubaisuu){
    lowkoubaisuu=iii;
  }
}
}
  cout<<maxkouyakusuu<<" "<<lowkoubaisuu<<endl;
  ++i;
}
  return 0;
}

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

int main() {
	int a, b,i;
		while (cin >> a >> b) {
			for (i = a; i > 0; i--) {
				if (b%i == 0 && a%i == 0) {
					cout << i << " ";
					break;
				}
				if (i == 0)
					cout << 1 << " ";
			}
			if (a > b)
				i = a;
			else
				i = b;
			while (i%b != 0) {
				i += a;
			}

			if (a > b) {
				for (i = a; i%b; i += a);
				cout << i << endl;
			}
			else {
				for (i = b; i%a; i += b);
				cout << i << endl;
			}
		}
	return 0;
}

C++: #include <stdio.h>

int gcd( int m, int n)
{
if(n==0)
return m;
else
return gcd(n,m%n);
}

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

int main()
{
int a, b;
while(scanf("%d%d", &a,&b)==2)
{
printf("%d", gcd( a, b));
printf(" %d", lcm(a , b));
}
return 0;
}

C++: 

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
using namespace std;

int gcd(int n, int m){
    if (n>=m) {
        if(n%m>0){
            return gcd(m,n%m);
        }else{
            return m;
        }
    }else{
        return gcd(m,n);
    }
}

int main(){
    double a,b;
    while (cin >> a ,cin >> b) {
        int g = gcd(a,b);
        int l = a*b/g;
        cout <<g<<" "<<l;
    }
}

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

typedef long long ll;

int main(){
    ll m, n;
    while(scanf("%lld%lld", &m, &n) == 2){
        if(m > n){
            ll t = m;
            m = n;
            n = t;
        }
        ll r, a = m, b = n;
        while(n % m != 0){
            r = n % m;
            n = m;
            m = r;
        }
        printf("%lld %lld\n", r, a / r * b);
    }
}

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>
#include <cstdio>
using namespace std;

int main()
{
	int lam,gcd,a,b,c,d;
	while(cin>>a>>b)
	{
		c=a;
		d=b;
		if(a<b)
		{
			a=a+b;
			b=a-b;
			a=a-b;
		}
		while(a%b!=0)
		{
			int temp;
			temp=b;
			b=a%b;
			a=temp;
		}
		gcd=b;
		lam=d/gcd*c;
		printf("%d %d\n",gcd,lam);
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;
typedef pair<ll, ll> Pll; 
#define PI 3.14159265

ll gcd(ll a, ll b) {
	if (a < b) swap(a,b);
	if (b == 0) return a;
	return gcd(b, a%b);
}

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

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

C++: #include <iostream>
#include <utility>
 
using namespace std;
 
int gcn(int a,int b){
if(a < b){swap(a,b);} 
while(b != 0){
a = a%b;
swap(a,b);
}
return a;
}
 
int main() {
	int n;int m;
while(cin >> n >> m){
cout << gcn(n,m) << " " << n/gcn(n,m) *m << endl;
}
	return 0;
}

C++: #include<iostream>

using namespace std;

long long int a,b;

int main(void)
{
	while(cin>>a>>b){
	//a=625; b=25;
		long long int x,y;
		x=1;
		for(int i=2;i<=a&&i<=b;){
			if(a%i==0&&b%i==0){
				x=x*i;
				a=a/i;
				b=b/i;
				i=2;
			}
			i++;
		}
		y=x*a*b;
		cout<<x<<" "<<y<<endl;
		//cin>>a;
	}
}

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

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

int gcd(int x,int y){
  if(y == 0) return x;
  return  gcd(y,x%y);
}

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

int main(){
  int x,y;
  while(scanf("%d%d",&x,&y) != EOF) cout << gcd(x,y)<<" "<<lcm(x,y)<<endl;
  return 0;
}

C++: #include<iostream>
long long gcd(long long a,long long b){
  if(b==0) return a;
  gcd(b,(a%b));
}

int main() {
  long long i,j,res;
  while(std::cin>>i>>j) {
    res=gcd(i,j);
    std::cout<<res<<" "<<(i*j)/res<<"\n";
  }
}

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

int main() {
int a,b,e,f,l;
	while(cin>>a>>b){
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	;break;
	    }
		}
	}
	return 0;
}