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

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<stdio.h>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
	int  a, b, a1, b1, c, g;
	long l;

	while (cin >> a >> b)
	{
		a1 = a;
		b1 = b;
		if (a == b)
		{
			g = a;
			break;
		}
		if (a == 0 || b == 0)
		{
			break;
		}
		while (1)
		{
			c = abs(a - b);
			if (c == 0)
			{
				break;
			}

			if (a > b)
			{
				a = c;
				g = c;
			}
			else if (a < b)
			{
				b = c;
				g = c;
			}
		}
		l = (a1 / g)*b1;
		cout << g << " " << l << endl;

		a1 = a; b1 = b;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

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

C++: #include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
ll a, b;
ll gcd(ll a, ll b)
{
	if(b == 0) return a;
	return gcd(b, a%b);
}
int main()
{
	while(cin >> a >> b)
		cout << gcd(a, b) << " " << a/gcd(a, b)*b << endl;
	return 0;
}

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

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

long lcm(int m, int n) {
    if((0 == m) || (0 == n)) return 0;
    return((m / gcd(m, n)) * n);
}

int main() {
    vector<int> v1;
    vector<int> v2;
    while(cin) {
        int a, b;
        cin >> a >> b;
        v1.push_back(a);
        v2.push_back(b);
    }
    for(int i=0; i<v1.size();i++) {
        cout << gcd(v1[i], v2[i]) << " " << lcm(v1[i], v2[i]) << endl;
    }
    return 0;
}

C++: #include<stdio.h>
#include<math.h>
 
int main(){
    unsigned int a,b;
    while(~scanf("%u%u",&a,&b)){
        unsigned int c=a,d=b;
        while(a>0&&b>0){
            if(a>b)a=a%b;
            else b=b%a;
        }
        printf("%u %u\n",a+b,c/(a+b)*d);
    }
}

C++: //
//  main.c
//  c
//
//  Created by ????????? on 2016/12/10.
//  Copyright ?? 2016??´ ?????????. All rights reserved.
//

#include <stdio.h>
int main(){
   int a, b, r, lcm, x, y;
    while (scanf("%d %d",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%d %d\n",y,lcm);
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;
typedef vector<int> VI;
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )

template<typename T>
T gcd(T m, T n) {
    return n == 0 ? m : gcd(n, m % n);
}

template<typename T>
T lcm(T m, T n) {
    return (m * n) / gcd(m, n);
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    vector<pair<long, long>> pairs;
    long ta, tb;
    while (cin >> ta >> tb) {
        pair<long, long> tmp;
        tmp.first = ta;
        tmp.second = tb;
        pairs.push_back(tmp);
    }
    
    for (auto p : pairs) {
        cout << gcd(p.first, p.second) << " " << lcm(p.first, p.second) << endl;
    }
    
    return 0;
}

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

int main(){

  int n[2];
  int yaku,bai;
  while(cin >> n[0] >> n[1]){
    sort(n,n+2);
    for(yaku=n[0];1<yaku;yaku--)
      if(n[0]%yaku==0 && n[1]%yaku==0)
	break;

    for(bai=1;bai<=n[0];bai++)
      if((bai*n[1])%n[0]==0){
	bai *= n[1];
	break;
      }
    cout << yaku << ' ' << bai << endl;
  }
  return 0;
}

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

int main()
{
	int a,b;
	while(scanf("%d %d",&a,&b))
	{int gcd=0;
	int lcf=0;
	for(int i=2;i<=min(a,b);i++)
		if(a%i==0&&b%i==0)gcd=i;
	for(int i=b;i>1;i--)
		if(a*i%b==0)lcf=a*i;
	cout<<gcd<<" "<<lcf<<endl;
	}
}

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

int main() {
unsigned long long a,b,e,f,l;
	while(cin>>a>>b){
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	;break;
	    }
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int gcd(long long a,long long b)
{
	if(!b)
		return a;
	return gcd(b,a%b);
}
int main()
{
	long long n,m;
	while(scanf("%lld%lld",&n,&m))
	{
		int tp=gcd(n,m);
		printf("%lld %lld\n",tp,n/tp*m);
	}
	return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
		int tmp=a;
		a=b;
		b=tmp%b;
		if(a%b==0)break;
	}
	if(b!=0)cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main(void)
{
	int x[1000],x2[1000],y[1000],y2[1000],z[1000],w[1000],t[1000],i=0,j=0;

	while(i!=-1)
	{
		scanf("%d %d",&x[i],&y[i]);		   
		x2[i] = x[i];
		y2[i] = y[i];
		if(x[i]<=0 || x[i]>2000000000 || y[i]<=0 || y[i]>2000000000)break;
		i=i+1;
	}
	for(j=0;j<i;j++)
	{
	   while(x[j] % y[j] !=0)
	   {
     	  z[j] = x[j] % y[j];
 		  x[j] = y[j];
 		  y[j] = z[j];
	   }
	   w[j] = x2[j] * y2[j] / y[j];
	   printf("%d %d\n",y[j],w[j]);
	}
  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<stdio.h>
int main(void)
{
	int a,b,x,y,s;
	int i,temp;

	while(scanf("%d %d",&a,&b)!=EOF){
		x=a;
		y=b;
		if(a<b){
			
			temp=a;
			a=b;
			b=temp;
		}
		while(b!=0){
			a=a%b;
			temp=a;
			a=b;
			b=temp;
		}
		x=x/a;
		y=y/a;
		s=a*x*y;
		printf("%d %d\n",a,s);
	}
	return 0;
}

C++: 
#include <stdio.h>

void sort(int *a, int *b) {
  if (*a < *b) {
    *a += *b;
    *b = *a - *b;
    *a -= *b;
    return;
  } else {
    return;
  }
}

int GCD(int a, int b) {
  int j, i = 1;
  
  if (a == 1 || b == 1) {
    return 1;
  }
  
  for (j = 2; j <= a; j++) {
    if (a % j == 0 && b % j == 0) {
      
      a /= j;
      b /= j;
      i *= j;
      i *= GCD(a, b);

      break;
      
    }
  }
  
  return i;
}

long LCM(int a, int b, int c) {
  long i;
  
  if (a % b == 0) return a; 
  
  i = a * b / c;
  
  return i;
}

int main() {
  
  int a, b;
  int n;
  long m;
  while (1) {
    if (scanf("%d %d", &a, &b) == EOF) break;
    
    
    sort(&a, &b);
    n = GCD(a, b);
    m = LCM(a, b, n);
    printf("%d %ld\n", n, m);
  }
  return 0;
}