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>
#include <vector>

int main(void);
int gcd(int x, int y);
int lcm(int x, int y);

int main(){
	int dataset_count = 0;
	int first_num = 0;
	int second_num = 0;

	std::vector<int> first_num_vector;
	std::vector<int> second_num_vector;

	while ((std::cin >> first_num >> second_num) || (dataset_count < 50)){
		dataset_count++;
		first_num_vector.push_back(first_num);
		second_num_vector.push_back(second_num);
	}
	for (int i = 0; i < first_num_vector.size(); i++){
		std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl;
	}
	return 0;
}


// 最大公約数を求める関数
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

//	最小公倍数を求める関数
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	return (x * y / gcd(x, y));
}

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

int main(){
    int a,b,a1,b1,r;
    int tmp=0;
    int i=0;
    
    while(scanf("%d %d",&a,&b)){
        if(a<b){
            tmp=a;
            a=b;
            b=tmp;
        }
        
        a1=a;
        b1=b;
        r=a1%b1;
        while(r!=0){
            a1=b1;
            b1=r;
            r=a1%b1;
            
        }
        printf("%d %ld\n",b1,(long)a*b/b1);
    }
    
    
    return 0;
    
}

C++: #include<iostream>
using namespace std;
int main()
{
  int a,b;
  while(cin.peek!=EOF)
  {
    cin>>a>>b;
    int w=a,f=b;
    int temp=a%b;
    while(temp!=0)
    {
      a=b;
      b=temp;
      temp=a%b;
    }
    cout<<b<<" "<<w/b*f<<endl;
  }
  return 0;
}

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

int saidai(long long int a,long long int b){
	while(b){
		int m=a%b;
		a=b;
		b=m;
	}
	
	return a;
}


int	saisyou( long long int a,long long int b ){
	return (a*b)/saidai(a,b);
}

int main(){
	long long int a,b;
	cin>>a;
	cin>>b;
	
	cout<<saidai(a,b)<<" "<<saisyou(a,b);;
	return 0;

}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long long a,b,i,aans=0,bans=0,ans=0;
	long long kobaisu=0;
	while(cin>>a>>b){
		for(i=2;i<=a;i++){
			aans=a%i;
			bans=b%i;
			if(aans==0 && bans==0)ans=i;
		}
		kobaisu=(a*b)/ans;
		cout<<ans<<" "<<kobaisu<<endl;
	}
	return 0;
}

C++: using System;
using System.Linq;
public class Test {
	public static int gcd(int x, int y) {
		if(y == 0) return x;
		return gcd(y, x % y);
	}
	public static int lcm(int x, int y) {
		return x / gcd(x, y) * y;
	}
	public static void Main() {
		string buf;
		while(!string.IsNullOrEmpty(buf = Console.ReadLine())) {
			string[] sc = buf.Split();
			int a = int.Parse(sc[0]), b = int.Parse(sc[1]);
			Console.WriteLine(gcd(a, b) + " " + lcm(a, b));
		}
	}
}

C++: /* All men have limits. They learn what they are and learn
   not to exceed them, I ignore mine. -Batman           */
#include <bits/stdc++.h>
//#include <iostream>
//#include <Windows.h>
using namespace std;
long long int gcd(long long int a,long long int b){
while(1){
	if(a==0)return b;
	b%=a;
	if(b==0)return a;
	a%=b;
}
}

int main(){
long long int a,b;
while(cin>>a>>b)
cout<<gcd(a,b)<<" "<<a*b/gcd(a,b)<<endl;

return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n];
	for(int i=0;i<n;i++) p[i] = 0;
	for(int i=2;i<n;i++){
		if(p[i]==0) for(int j=2;j<n/i;j++) p[i*j] = 1;
	}
	int q[n];
	int c = -1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			c++;
			q[c] = i;
		}
	}
	long a,b;
	while(cin >> a >> b){
		int t[c],s[c];
		for(int i=0;i<c;i++) t[i] = 0;
		for(int i=0;i<c;i++) s[i] = 0;
		int as = a;
		while(1){
			int temp = as;
			for(int i=0;i<c;i++){
				if(as%q[i]==0){
					s[i]++;
					as = as/q[i];
				}
			}
			if(temp==as) break;
		}
		int at = b;
		while(1){
			int temp = at;
			for(int i=0;i<c;i++){
				if(at%q[i]==0){
					t[i]++;
					at = at/q[i];
				}
			}
			if(temp==at) break;
		}
		long z = 1;
		if(at==as) z = at;
		long y = z;
		for(int i=0;i<c;i++){
			y *= pow(q[i],max(s[i],t[i]));
			z *= pow(q[i],min(s[i],t[i]));
		}
		cout << z << " " << y << endl;
	}
}

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

C++: #include<cstdio>
long int a,b,G,L,i,j;
long int gcd(long int a,long int b)
{    return(0==b?a:gcd(b,a%b));}
int main()
{
    while(scanf("%ld%ld",&a,&b)!=EOF)
    {
        G=gcd(a,b);
        i=a/G;
        L=b*i;
        printf("%ld %ld\n",G,L);
    }
    return 0;

}

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

long long lcm(int a,int b)
{
    return a/gcd(a,b)*b;
}
int main()
{
    //freopen("in.txt","r",stdin);
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }


    return 0;
}

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

u_int euclid_alg(const u_int a, const u_int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	u_int a,b;
	std::vector<u_int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		u_int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::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>
#include<iostream>
#include<algorithm>
using namespace std;
long long gcd(long long a,long long b); 
main(){
  long long a,b,GCD,LCM;
  while(cin >> a >> b){
    GCD = gcd( a , b );
    LCM = (a * b)/GCD;
    cout << GCD << ' ' << LCM << endl;
  }
}
long long gcd(long long a,long long b){
  if(b == 0)return a;
  return gcd( b , a % b );
}

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


int main(){
	int a, b, tmp, x, y, z;
	while (true){
		cin >> a >> b;
		if (cin.eof()){
			break;
		}
		if (a < b){
			 tmp = a;
			 x = b;
		}
		else {
			x = a;
			tmp = b;
		}
		while (tmp != 0) {
			y = tmp;
			tmp = x % y;
			x = y;
		}
		z = a / y * b;
		cout << y << " " << z << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  long int sn = 0;
  long int bn = 0;
  long int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0) lcm = i;
    break;
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0) gcd = i;
    break;
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}