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

long GCD(long, long);
long LCM(long, long);

long gcd, lcm;

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

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

long LCM(long a, long b){
	return a*b/gcd;
}

C++: #include <cstdio>
#define llong long long

int main() {
  llong a,b;
  while(scanf("%lld %lld", &a, &b) != EOF) {
    llong lcm = a*b;
    while(a != 0 && b != 0) {
      if(a >= b) a = a%b;
      else b = b%a;
    }
    llong gcd = a+b;
    lcm /= gcd;
    printf("%lld %lld\n", gcd, lcm);
  }
  return 0;
}

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


int main(){
	int a, b, tmp, x, y, z;
	while (true){
		cin >> a >> b;
		if (cin.eof()){
			break;
		}
		if (a < b){
			 tmp = a;
			 x = b;
		}
		else {
			x = a;
			tmp = b;
		}
		while (tmp != 0) {
			y = tmp;
			tmp = x % y;
			x = y;
		}
		z = a / y * b;
		cout << to_string(y) << " " << to_string(z) << endl;
	}
	return 0;
}

C++: #include <cstdio>
int main(){
	long a,b,x,y;
	while (~scanf("%ld%ld", &a, &b)) {
		for(x=a,y=b; x%=y; x^=y^=x^=y);
		printf("%ld %ld\n", y, a*b/y);
	}
}

C++: #include<iostream>
using namespace std;
 
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
 
int main(){
    int a,b,g,l;
    while(cin>>a>>b){
        g=gcd((a>=b)?a:b,(a>=b)?b:a);
        l=(a/g)*b;
        cout<<g<<" "<<l<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int a = 0;
	long long int b = 0;
	while (cin >> a, cin >> b)
	{
		long long int c = 0;
		long long int d = 0;
		long long int e = 0;
		c = a;
		d = b;
		if (c < d)
		{
			long long int i = 0;
			i = d;
			d = c;
			c = i;
		}
		while (1)
		{
			e = c % d;
			if (e == 0)
			{
				break;
			}
			c = d;
			d = e;
		}
		cout << d << " " << a / d * b << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a%b);
}

int main(void) {
	long long p, q, r;
	while (cin >> p >> q) {
		if (p < q) {
			swap(p, q);
		}
		r = gcd(p, q);
		cout << r << ' ' << p*q / r << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
long long gcm(long long a, long long b){
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}	
	long long c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main(){
	for(int i=1;i<=10;i++){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<((c/e)*(d/e)*e)<<endl;
	}
}

C++: /********************************************************************
 * ??£?????´??° a,b ?????\?????????a ??¨ b ????????§??¬?´???°??¨????°???¬?????°???????????????
 * ????????°?????????????????????????????????
 ********************************************************************/
#include <iostream>
#include <cstring>
typedef struct _input_values {
    int a;
    int b;
} INPUT_VALUES;

typedef struct _input_values_list {
    INPUT_VALUES sList[10000];
    int effectCount;
} INPUT_VALUES_LIST;

int gcd( int a, int b );    // ?????§??¬?´???°????±???????
int lcm( int a, int b, int g );    // ????°???¬?????°????±???????

using namespace std;

int main()
{
    int i = 0;
    int tA = 0, tB = 0;
    int g = 0, l = 0;
    INPUT_VALUES_LIST values;

    memset( &values, 0, sizeof(values) );

    while( cin >> tA >> tB ) {
        values.sList[values.effectCount].a = tA;
        values.sList[values.effectCount].b = tB;
        values.effectCount++;
    }

    for ( i = 0; i < values.effectCount; i++ ) {
        g = gcd( values.sList[i].a, values.sList[i].b );
        l = lcm( values.sList[i].a, values.sList[i].b, g );
        cout << g << " " << l << endl;
    }

    return 0;
}

/*  @brief  ?????§??¬?´???°????±???????
 *  @param  [i] a   ???????????????
 *  @param  [i] b   ???????????????
 *  @retval ?????§??¬?´???°
 */
int gcd( int a, int b )
{
    int ret = 0;

    if ( 0 == a || 0 == b ) {
        return 0;
    }

    if ( a != b ) {
        if ( a > b ) {
            a = a - b;
        } else {
            b = b - a;
        }
    } else {
        return a;
    }

    ret = gcd( a, b );

    return ret;
}

/*  @brief  ????°???¬?????°????±???????
 *  @param  [i] ???????????????
 *  @param  [i] ???????????????
 *  @param  [i] ?????§??¬?´???°
 *  @retval ????°???¬?????°
 */
int lcm( int a, int b, int g )
{
    if ( 0 == a || 0 == b ) {
        return 0;
    }

    return ( a * b / g );
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int x,y;
	while(cin>>x>>y){
		cout<<__gcd(x,y)<<' '<<x/__gcd(x,y)*y<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
int f(int a,int b){
     int n;
     n=a%b;
   return n;
}
int main(){
    int a,b,c,d,x,y,z;
    while(cin>>x>>y){
    a=x;
    b=y;
      for(d=0;c>0;d++){
         c=f(a,b);
         a=b;
         b=c;
    }
    z=x*y/a;
    cout<<a<<" "<<z<<endl;
    }
         return 0;
}

C++: #include <stdio.h>

int main(){
    float a[20],b[20];
    int nCount = 0;
    while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){
        nCount++;
    }

    for( int k = 0;k < nCount;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    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 <cstdio>
#include <algorithm>
using namespace std;

typedef long long ll;

ll GCD(ll x, ll y) {
  if (x < y) swap(x, y);

  return y == 0 ? x : GCD(y, x % y);
}

ll LCM(ll x, ll y, ll gcd) {
  return x / gcd * y;
}

int main()
{
  int a, b;

  while (scanf("%d%d", &a, &b) != EOF) {
    ll gcd = GCD(a, b);
    printf("%lld %lld\n", gcd, LCM(a, b, gcd));
  }
  
  return 0;
}

C++: //----- ユークリッドの互除法を行う関数 -----//

int f_kouyakusuu(int , int , int*);

//----- 最小公倍数を求める関数 -----//

int f_koubaisuu(int , int , int*);


//*****----- main -----*****//

int main(void)
{
	//入力変数2つ
	int x = 0 , y = 0;
	//公約数と公倍数は保存しておかなければならない
	int kouyakusuu = 0 , koubaisuu = 0;

	while (scanf("%d %d" , &x , &y) != EOF)
	{
		koubaisuu = f_koubaisuu(x , y , &kouyakusuu);
		printf("%d %d\n" , kouyakusuu , koubaisuu);
	}

	return 0;
}




//*****----- ユークリッドの互除法を利用する関数 -----*****//

int f_kouyakusuu(int x , int y , int *kouyakusuu)	//最初ｘ＜ｙでもforによって入れ替えられる
{
	//保存変数
	int hozon = 0;

	//割って0になるまで
	while ((hozon = x % y) != 0)
	{
		x = y;
		y = hozon;
	}

	//公約数を保存する
	*kouyakusuu = y;
	//最後に割ったｘを返す
	return y;
}



//*****----- 最小公倍数を求めるプログラム *****-----//

int f_koubaisuu(int x , int y , int *kouyakusuu)
{
	//最初に計算して値を小さくする
	int modoriti = f_kouyakusuu(x , y , kouyakusuu);
	//値がでかいので工夫
	unsigned long long int hozon = x * y;
	hozon = x / modoriti;
	//計算して値を返す
	return hozon * y;
}