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 <stdio.h>
 
int yakusuu(int a,int b);
 
int main(void){
int a,b,c;
while(scanf("%d %d",&a,&b)!=EOF){
c=yakusuu(a,b);
printf("%d %d\n",c,(a*b/c));
}
return 0;
}
 
int yakusuu(int a,int b){
int n=2,c=1;
while(n<=a && n<=b){
if(a%n==0 && b%n==0){
a=a/n;
b=b/n;
c=c*n;
}
else{
n=n+1;
}
}
return c;
}

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

int main(){
    int a,b;
    while (cin >> a >> b) {
        int koua,koub;
        koua = a;
        koub = b;
        if(koua < koub) {
            int temp = koua;
            koua = koub;
            koub = temp;
        }
        int r;
        while ((r =koua % koub) != 0) {
            koua = koub;
            koub = r;
        }
        int baia = a, baib = b;
        while(baia != baib) {
            if (baia < baib) {
                baia += a;
            }
            else {
                baib += b;
            }
        }
        cout<< koub << " " << baia << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);
int main(){
  int x,y,z;
  while(cin >>x>>y){
    z = gcd(x,y);
    cout <<z<<" "<<x/z*y<<endl;
  }
  return 0;
}
int gcd(int x, int y){
  if(y == 0) return x;
  return gcd(y,x%y);
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		int gcd = 0;
		long long lcm = 0;
		int r = 0;
		int temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 long long int gcd(long long int p,long long int q)
 {
   return q==0 ? p:gcd(q,p%q);     
 }

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

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

int main() {
	int a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if(a == 0) {
			cout << 0 << " " << 0 << endl;
			break;
			}
			if ((max(a, b) % min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = a%b;
			}else b = b%a;
		}
		if(a != 0) { 
		cout << " " << c / min(a,b) * d << endl;
		}
	}

	return 0;
}

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

C++: #include<iostream>
#include<cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while(1)
    {
        cin>>n>>m;
        cout<<t<<" "<<n*(m/t)<<endl;
    }
    return 0;
}

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

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

int main() {
    long a, b;
    while (cin >> a >> b) {
    long GCD_a, LCM_a;
    GCD_a = GCD(a, b);
    LCM_a = a * b / GCD(a, b);
    cout << GCD_a << ' ' << LCM_a << endl;
    }
}

C++: /*
 * hujx.cpp
 *
 *  Created on: 2015年5月21日
 *      Author: dell
 */
#include<stdio.h>
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<time.h>
#include<queue>
#include<stack>
#include<iterator>
#include<math.h>
#include<stdlib.h>
#include<limits.h>
#include<map>
#include<set>
#include<bitset>
//#define ONLINE_JUDGE
#define eps 1e-5
#define INF 0x7fffffff
#define FOR(i,a) for((i)=0;i<(a);(i)++)
#define MEM(a) (memset((a),0,sizeof(a)))
#define sfs(a) scanf("%s",a)
#define sf(a) scanf("%d",&a)
#define sfI(a) scanf("%I64d",&a)
#define pf(a) printf("%d\n",a)
#define pfI(a) printf("%I64d\n",a)
#define pfs(a) printf("%s\n",a)
#define sfd(a,b) scanf("%d%d",&a,&b)
#define sft(a,b,num) scanf("%d%d%d",&a,&b,&num)
#define for1(i,a,b) for(int i=(a);i<b;i++)
#define for2(i,a,b) for(int i=(a);i<=b;i++)
#define for3(i,a,b)for(int i=(b);i>=a;i--)
#define MEM1(a) memset(a,0,sizeof(a))
#define MEM2(a) memset(a,-1,sizeof(a))
#define ll long long
const double PI=acos(-1.0);
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> inline T Min(T a,T b){return a<b?a:b;}
template<class T> inline T Max(T a,T b){return a>b?a:b;}
using namespace std;
//#pragma comment(linker,"/STACK:1024000000,1024000000")
int n,m,c;
#define N 210
#define M 100010
#define Mod 1000000000
#define p(x,y) make_pair(x,y)
const int MAX_len=550;
int main(){
    ll a,b;
    while(scanf("%lld%lld",&a,&b)!=EOF){
    	ll GCD = gcd(a,b);
    	ll LCM = a/GCD*b;
    	printf("%lld %lld\n",GCD,LCM);
    }
    return 0;
}

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

int gcd(int a, int b) {
  	int q,r;
	while(r!=0){
	q=a/b;
	r=a%b;
	a=b;
	b=r;
	}
	return b;
}

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

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

TYPE gcd(TYPE a,TYPE b){
  if( !b ) return a;
  return gcd(b, a%b);
}
int main(){
  TYPE a,b;
  while(cin>>a>>b){
    TYPE g = gcd(a,b);
    TYPE l = a/g*b;
    cout << g << " " << l << endl;
  }
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
	int  a, b, a1, b1, c, g;
	long l;
	cin >> a >> b;
	a1 = a;
	b1 = b;
	while (cin>>a>>b)
	{
		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;
	}
}

C++: #include<iostream>
int e(int a,int b){
	if(a<b)a^=b^=a^=b;
	return (a%=b)?e(b,a):b;
}
int f(int a,int b,int c,int d){
	if(a<b)a^=b^=a^=b;
	for(;a>b;)b+=d;
	return a-b?f(b,a,d,c):a;
}
int main(){
	for(int a,b,s;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",e(a,b),f(a,b,a,b)))
		;
}

C++: #include<cstdio>
#include<iostream>
class GCDandLCM{
    public:
        void solve(int a,int b){
            int big=a,small=b;
            if(a<b){ 
                big=b;
                small=a;
                int tmp=a;
                a=b;
                b=tmp;
            }
            while(big%small!=0){ 
                int tmp=big%small;
                big=small;
                small=tmp;
            }
            printf("%d %d\n",small,(a*b)/small);
        }
};
int main(){ 
    GCDandLCM inst;
    int a,b;
    while(scanf("%d%d",&a,&b)){ 
        inst.solve(a,b);
    }
}