Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			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;

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

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int gcd( int m, int n ){
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

int lcm( int m, int n ){
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

int main(){
 cout << gcd(8,2) << " "<< lcm(8,4) << endl;
}

C++: #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int v[100000];

void division(long int a,long int b,long int *L,long int *G){
  long int i;
  int j=0;
  for(i=2;i<2000000000;i++){
    if(a%i==0 && b%i==0){   //a??¨b?????¨???????????????????????????
      a/=i;  b/=i;
      v[j]=i;    //?????£???????????\????????????
      i--;
      j++;   //?????£?????????????´???´???
    }
    if(i>a || i>b){
      break;
    }
  }
  for(i=0;i<j;i++){
    (*G) *=v[i];
  }
  *L = (*G) * a * b;
}

int main(void){
  long int GCD=1;
  long int LCM=1;
  long int a,b;

  while(cin>>a>>b){
    GCD=1;LCM=1;
    division(a,b,&LCM,&GCD);
    printf("%d %d",GCD,LCM);
  }
  printf("\n");

  return 0;
  
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

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

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

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long n=max(a,b);
	long ans=1;
	for(long i=1;i<=n;i++){
		if(a%i==0&&b%i==0)ans=i;
	}
	return ans;
}

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

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

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (; i <= minimum; i++) {
            if (a % i == 0 && b % i == 0) {
                break;
            } else if (i == minimum) {
                i = 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: //
//  main.cpp
//  CppTest
//
//  Created by Ryu on 2017/02/08.
//  Copyright ?? 2017??´ Ryu. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

long gcd(long x, long y){
    if (x > y) {
        if(x % y == 0){
            return y;
        }else{
            return gcd(y, x % y);
        }
    }else{
        if (y % x == 0) {
            return x;
        }else{
            return gcd(x, y % x);
        }
    }
}

int main(int argc, const char * argv[]) {
    // insert code here...
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    long a[50], b[50], g[50], l[50];
    int n = 0;
    while (cin >> a[n] >> b[n]){
        g[n] = gcd(a[n], b[n]);
        l[n] = a[n] * b[n] / g[n];
        //printf("d: %f, x: %.4f, y: %.4f\n", d, x[n], y[n]);
        n++;
    }
    
    
    for(int i = 0; i < n; i++){
        printf("%ld %ld\n", g[i], l[i]);
    }
    
    
    return 0;
}

C++: #include <algorithm>
#include <iostream>
using namespace std;
 
int main() {
    long long int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

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

typedef long long lli;

lli gcd(lli a, lli b) {
  return b == 0 ? a : gcd(b, a%b);
}

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

int main() {
  lli a, b;

  while(cin >> a >> b) {
    cout << gcd(a, b) << " " << lcm(a, b) << endl;
  }
  return 0;
}

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

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

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


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

			if((z[i] <= 200000000) && (z[i] > 0 )){
				if((z[i+1] <= 2000000000) && (z[i+1] > 0)) break;
			}
		}


	}

	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<iostream>

int gcd(int a, int b){
  int k;
  if(b>a){
    k=b;
    b=a;
    a=k;
  }
  while(k!=0){
    k = a % b;
    a = b;
    b = k;
  }
  return a;
}

int main(){
  int a, b;

  while(std::cin >> a >> b){
    std::cout << (a*b)/gcd(a,b) << " " << gcd(a,b) << std::endl;
  }
}