Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <queue>
#include <stack>
#include <list>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <utility>
#include <climits>
using namespace std;

#define print(v) for (int i = 0; i < v.size(); ++i) cout << v[i] << " "; cout << endl;
template <class T>
void printMatrix(vector< vector< T > >& matrix) {
  for (int i = 0; i < matrix.size(); ++i) {
    for (int j = 0; j < matrix[i].size(); ++j) {
      cout << matrix[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector< ii > vii;

const int UNVISITED = -1;
const int VISITED = 1;
const int INF = 1000000005;

vector<vi> AdjMatrix;
vector<int> dfs_num;

long long gcd(long long a, long long b) {
  return (!b) ? a : gcd(b, a % b);
}

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

int main() {
  long long a, b;
  while (cin >> a >> b) {
    long long gcdResult = gcd(a, b);
    long long lcmResult = lcm(a, b);
    cout << gcdResult << " " << lcmResult << endl;
  }
}

C++:  #include <stdio.h>
using namespace std;
 long long int n,m,ans,amari,ahokusa;

 int main(void)
 {
    while(1)
    {
         scanf("%lld%lld",&n,&m);
         ans  = n*m;
         if(n < m)
         {
             ahokusa = n;
             n = m;
             m = ahokusa;
         }
         amari = n % m;
         while(amari != 0)
         {
            n = m;
            m = amari;
            amari = n % m;
         }
         ans = ans / m;
         printf("%lld %lld\n",m,ans);
    }

     return 0;

 }

C++: #include<stdio.h>

int main(void)
{
	int num[2],koyak,escape;
	
	long int i;
	
	long int kobai;
	
	while(scanf("%d %d",&num[0],&num[1]) != EOF )
	{
		kobai = 0;
		koyak = 0;
		
		if(num[0] < num[1])
		{
			escape = num[0];
			num[0] = num[1];
			num[1] = escape;
		}
		
		for(i = num[1] ; i >= 1 ; i--)
		{
			if(0 == num[0] % i && 0 == num[1] % i)
			{
				koyak = i;
				break;
			}
		}
			
		i = 1;
		
		while(1) 
		{
			if(0 ==( num[0] * i ) %  num[1])
			{
				kobai = num[0] * i;
				break;
			}
			
			i++;
		}
		
		printf("%d %ld\n",koyak,kobai);
		
	}
	
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <vector>

using namespace std;

int getcom(int x, int y) {
	int no = 2;

	while (true) {
		if (no > x || no > y) {
			return 1;
		}

		if (x % no == 0 && y % no == 0) {
			x = x / no;
			y = y / no;
			return no * getcom(x, y);
		}
		no++;
	}
}

int main(void) {
	int a, b;

	vector<string> v;
	while (cin >> a >> b) {
		int com_div, com_mlt;

		com_div = getcom(a, b);
		com_mlt = (a / com_div) * (b / com_div) * com_div;
		stringstream ss;
		ss << com_div << " " << com_mlt;
		v.push_back(ss.str());
	}

	for (int i = 0; i < v.size(); i++) {
		cout << v[i] << endl;
	}

	return 0;
}

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

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}
int main() {
ll a, b;
while(cin >> a >> b)
cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;
}

C++: #include <cstdio>
using namespace std;
typedef long long LL;

LL gcd(LL a, LL b){
    while(b){
        LL tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}
int main(){
    LL a, b;
    while(~scanf("%d%d", &a, &b)){
        printf("%lld %lld\n", gcd(a, b), (a * b / gcd(a, b)));
    }
    return 0;
}

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

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



int main() {

	LL a, b;
	while (cin >> a) {
		cin >> 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,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;
}