Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

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

double gcd(double m,double n);
double lcm(double m,double n);

int main(){
	int i,n;
	double a,b;
	double z[10] ={0} ;
	double y[10] = {0} ;

	for(i=0;i<4;i+=2){
	cin >> a >> b ;
	z[i] = a ;
	z[i+1] = b ;
	}

	y[0] = gcd(z[0],z[1]) ;
	y[1] = lcm(z[0],z[1]) ;
	y[2] = gcd(z[2],z[3]) ;
	y[3] = lcm(z[2],z[3]) ;

	cout << y[0] << " "<< y[1] << "\n" ;
	cout << y[2] << " " << y[3] << endl ;
	return 0;
}

	double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

C++: #include <stdio.h>
int main(void){
    int a,b,d;
    while(~scanf("%d%d",&a,&b)){
        int&t=a<b?a:b,n=1;
        d=t;
        while(d>1){
            if(a%d||b%d)d--;
            else a/=d,b/=d,n*=d,d=t;
        }
        printf("%d %d\n",n,n*a*b);
    }
    return 0;
}

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

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

int lcm(unsigned long n1, unsigned long n2) {
	return n1 * n2 / gcd(n1, n2);
}

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

C++: #include<cstdio>
#include<iostream>

using namespace std;

int gcm(int a, int b){
	
	if(b > a){
	int d;
	d = a;
	a = b;
	b = d;
	}	
	
	int c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	
	}
	return a;
}

int main(){
	long int c,d,e;
	std::cin>>c>>d;

	e = gcm(c,d);

	std::cout<<e<<" "<<(c*d)/e;
}

C++: #include <iostream>

using namespace std;
long long GCD(long long a,long long b){
	long long ma = max(a,b);
	long long mi = min(a,b);
	while(mi!=0){
		long long temp;
		temp = mi;
		mi = ma % mi;
		ma = temp;
	}
	return ma;
}
long long LCM(long long a,long long b){
	return a*b/GCD(a,b);
}

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

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    ll a,b;
    while(cin>>a){
        cin>>b;
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
   
    
    
    
return 0;
}

C++: #include<iostream>
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 <stdio.h>
#include <math.h>

int main(){
    int a,b,x,y,t;
    int gcd,r;
    int l;
    while (scanf("%d %d",&x,&y)!=EOF){
    a = x;
    b = y;

    if(b==0) gcd = b;
    else if(a==0) gcd = b;
    else{
        while(b!=0){
            t = a/b;
            r = a% b;
            a = t;
            b = r;


        }
        gcd = a;
    }

    l = (x * y)/gcd;
    printf("%d %d",gcd,l);
    }

    return 0;


}

C++: #include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cstdio>
using namespace std;

#define FOR(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long>PLL;
typedef queue<int> QI;
typedef priority_queue<int> maxpq;
typedef priority_queue<int, vector<int>, greater<int> > minpq;

struct edge{int to, cost;};

void begin(){cin.tie(0); ios::sync_with_stdio(false);};
int gcd(int a, int b){if(a%b==0){return(b);}else{return(gcd(b,a%b));}};
int lcm(int m, int n){if((0 == m)||(0 == n)){return 0;} return ((m / gcd(m, n)) * n);};
unsigned long long comb(long n, long m){unsigned long long c = 1; m = (n - m < m ? n - m : m);
    for(long ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++){c *= ns; c /= ms;} return c;};

void warshallFloyd(int d[100][100], int n){
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j)
                if(d[i][k] != -1 && d[k][j] != -1){
                    if(d[i][j] == -1){
                        d[i][j] = d[i][k] + d[k][j];
                    }else{
                        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                    }
                }
};


// d:隣接行列  n:グラフのサイズ  s:始点  dist:始点からの距離が入る配列
void dijkstra(int d[1000][1000], int n, int s, int dist[1000]){
    FOR(i, n) dist[i] = -1;
    dist[s] = 0;
    priority_queue<PII, vector<PII>, greater<PII> > q;
    q.push(PII(0, s));
    while (!q.empty()) {
        PII p = q.top(); q.pop();
        int i = p.second;
        if(dist[i] < p.first) continue;
        for(int j = 0; j < n; j++){
            if(d[i][j] == -1) continue;
            if(dist[j] == -1){
                dist[j] = dist[i] + d[i][j];
                q.push(PII(dist[j], j));
            }else if(dist[j] > dist[i] + d[i][j]){
                dist[j] = dist[i] + d[i][j];
                q.push(PII(dist[j], j));
            }
        }
    }
};

int main(int argc, const char * argv[]){
    begin();
    int a, b;
    while(cin >> a >> b){
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
}

C++: #include<iostream>

using namespace std;

int gcd(int x,int y) {//??????????????????????????????
	int r;
	if (x < y)swap(x, y);
	while (y > 0) {
		r = x%y;
		x = y;
		y = r;
	}
	return x;
}

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

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

int main()
{
    long a,b,n=0;
    while(cin >> a >> b){
        if (a>b) {
            n = b;
            while (a % b != 0) {
                b = a % b;
            }
            cout << b << " " << a*n/b << endl;
        }
        
        if (b>a) {
            n = a;
            while (b % a != 0) {
                a = b % a;
            }
            cout << a << " " << b*n/a << endl;
        }

    }
}