Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <climits>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <deque>
#include <list>
#include <map>
#include <set>
using namespace std;

/*** typedef ***/
typedef long long LL;
typedef unsigned int ui;
typedef unsigned long long ULL;
typedef pair < int , int > ii;
typedef pair < LL  , LL  > ll;
typedef vector <int>  vint;
typedef vector <bool> vbool;
typedef vector <long> vlong;

/*** define ***/
#define sz(x)			((int)x.size())
#define tin(x)			scanf("%d",&x)
#define all(x)			x.begin(),x.end()
#define Set(b,a)		memset(b,a,sizeof b)
#define print1(x)		printf("Case %d:",x++)
#define tin2(x,y)		scanf("%d%d",&x,&y)
#define tin3(x,y,z)		scanf("%d%d%d",&x,&y,&z)
#define loop(i,i0,in)	for(int i=i0 ; i<in ; i++)
#define rep(i,n)		for(int i=0 ; i<(n) ; i++)
#define _rep(i,n)		for(int i=n-1 ; i>=0 ; i--)
#define _loop(i,in,i0)	for(int i=in-1 ; i>=i0 ; i--)
#define Fore(it, x)		for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)

LL gcd(LL a,LL 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()  
{  
#ifdef Online_Judge
	freopen("a.in","r",stdin);
#endif
	LL a,b;
	while(cin >> a >> b)
		cout << gcd(a,b) << ' ' << lcm(a,b) << endl;
	return 0;
}

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

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return a;
}

int main(){
    int data0,data1;
    int answer;
    while(cin>>data0>>data1){
        answer=gcd(data0,data1);
        cout<<answer<<" "<<data0/answer*data1<<endl;
    }
}

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d,r,s,h;
	while (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++: #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;}return 0;}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
   int a,b;
   double A,B;
   double GCD,LCM;
   double z;
   
   while(cin>>A>>B){
      if(A<B){
         z = A;
         A = B;
         B = z;
      }
      a = static_cast<int>(A);
      b = static_cast<int>(B);
   
      while(1){
         if(a%b == 0){
            GCD = static_cast<double>(b);
            break;
         }
         z = a%b;
         a = b;
         b = z;
      }
      LCM = A*B/GCD;
      
      printf("%.0lf %.0lf\n",GCD,LCM);
   }
   return 0;
}

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

C++: #include <cstdio>

int main()
{
    long a, b;
    long m, n, temp;

    while (scanf("%ld %ld", &a, &b) != EOF) {
        if (a < b) {
            temp = a;
            b = a;
            a = temp;
        }
        m = a;
        n = b;

        while (n > 0) {
            temp = n;
            n = m % n;
            m = temp;
        }

        printf("%ld %ld\n", m, a / m * b);
    }

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>

typedef long long ll;
using namespace std;

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

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

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

int main(){

int small,big,i,c,kouyaku,koubai;

while(cin >> small >> big){

if(small>big){//大小比較
c=big;
big=small;
small=c;
}

for(i=1;i<=big;i++){//最大公約数
if(big%i==0 && small%i==0)kouyaku=i;
}

for(i=1;i<=small;i++){//最小公倍数

if((big*i)%small==0){
koubai=big*i;
break;
}
}

cout << kouyaku << " " <<koubai << endl;//出力
}
return 0;
}

C++: #include <iostream>

typedef unsigned int ui;

void swap(ui & a, ui & b)
{
	unsigned int tmp = a;
	a = b;
	b = tmp;
}

ui gcd(ui a, ui b)
{
	if (a < b) swap(a, b);

	ui c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}

	return b;
}

int main() {
	using namespace std;

	ui a, b;
	while (cin >> a >> b) {
		const ui GCD = gcd(a, b);
		const ui LCM = (a / GCD) * (b / GCD) * GCD;
		cout << GCD << ' ' << LCM << endl;
	}
	return 0;
}

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

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		u_int minmul; //least common multiple
		u_int maxdivi = 1; //greatest common divisor
		u_int tmp_a = a;
		u_int tmp_b = b;

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = (tmp_a / maxdivi) * tmp_b; //a*b/maxdivi

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	return 0;
}

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

using namespace std;

int main()
{
	unsigned long a, b, r, c, d;
	unsigned long ta, tb;

	scanf("%d%d", &a,& b);
	ta = a;
	tb = b;

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	
	d = a * (b  / c);
	

	printf("%d %d\n", c, d);

	return (0);
}

C++: #include<iostream>

using namespace std;

int a, b, c, d;
int GCD, LCM;
int change;
int main()
{
	while(cin>>a>>b)
	{
		if(a<b)
		{
			change=a;
			b=a;
			a=change;
		}
		c=a;d=b;
		while(d!=0)
		{
			change=d;
			d=c%d;
			c=change;
		}
		GCD=c;
		LCM=a/GCD*b;
		printf("%d %d\n",GCD,LCM);
	}
}

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;
}

C++: #include <stdio.h>

int main(){
    int a,b,m,l;
    while(scanf("%d %d",&a,&b)!=EOF){
        m = a%b;
        l = a*b;
        while(m){
            a = b;
            b = m;
            m = a%b;
        }
        printf("%d %d\n",b,l/b);
    }
}