Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include <iostream>
using namespace std;
float LCM(float a,float b)
{
	if(a==b)
	return a;
	else
	{
		if(a>b)
		a-=b;
		else
		b-=a;
		LCM(a,b);
	}
}
int main()
{
	float a,b;
	long c;
	cin>>a>>b;
	while(a!=EOF||b!=EOF)
	{
		c=LCM(a,b);
		if(c>100000)
			cout<<c/10000<<"0000 "<<(a*b/c)/10000<<"0000"<<endl;
		else if((a*b/c)>100000)
			cout<<c<<" "<<(a*b/c)/10000<<"0000"<<endl;
		else
			cout<<c<<" "<<(a*b/c)<<endl;
		cin>>a>>b;
	}
}

C++: #include<iostream>
using namespace std;
int lcm(long long x,long long y);
int gcd(long long x,long long y);
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<lcm(a,b)<<" "<<gcd(a,b)<<endl;
    }

    return 0;
}
int lcm(long long x,long long y)
{
    long long a,i;
    if(x>y) a=y;
    else a=x;
    for(i=a;i>0;i--)
    {
        if(x%i==0 && y%i==0)
        {
            return i;
            break;
        }
    }


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

}

C++: #include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


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


  return 0;
}

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

int main() {
	// your code goes here
	long long a,b;
	long long r;
	long long gcd, lcm;
	while(cin>>a>>b){
		if(a<b){swap(a,b);}
		
		long long c=a , d=b;
		while(true){
		r=c%d;
		if(r==0)gcd=d; break;
		c=d; d=r;
		
		}

	lcm= a*b / lcm;
	
	
	cout << gcd << " " << lcm << endl;	
	}
	return 0;
	
	
}

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

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

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


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

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long pow_mod(long long n,long long k,long long m){
    if (k == 0){
        return 1;
    } else if (k % 2 == 1){
        return pow_mod(n,k-1,m)*n % m;
    } else {
        long long t = pow_mod(n,k/2,m);
        return t*t % m;
    }
}

const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

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

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d,r,s,h;
	for (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++: /*
http://blog.csdn.net/liuke19950717
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int gcd(int a,int b)
{
	if(!b)
	{
		return a;
	}
	return gcd(b,a%b);
}
int main()
{
	int n,m;
	while(~scanf("%d%d",&n,&m))
	{
		int tp=gcd(n,m);
		printf("%d %d\n",tp,n/tp*m);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int a,n;
  cin>>a>>n;
  cout<<gcd(a,n)<<" "<<lcm(a,n)<<endl;
  
}

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 <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(b == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if (a > b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;
  }
  else if(a == b){
    cout << a << " " << a << endl;
  }

 }
 return 0; 
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
ll g,l;

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

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

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

C++: #include<iostream>
#include<algorithm>
#define LL long long

LL gcd(LL a, LL b) {
	if (a < b)std::swap(a, b);
	if (a%b != 0)gcd(b, a%b);
	else return b;
}

int main() {
	LL A, B;
	while (std::cin >> A >> B) {
		LL g = gcd(A, B);
		std::cout << g << " " << (A*B) / g << std::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){
				cout << i << " ";
				break;
			}
		}
		s = a;
		t = b;
		while(s != t){
			if(s > t){
				while(s > t){
					t += b;
				}
			} else {
				while(t > s){
					s += a;
				}
			}
		}
		cout << s << endl;
	}
	
	return 0;
}