Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
        if(a<0 || a>2000000000 || b<0 || b>2000000000)
        {
            return 0;
        }
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    }

}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#define esp 1e-8
using namespace std;
typedef long long ll;
int n,k;
double a[10005];
bool F(double mid)
{
    int ans=0;
    for(int i=0;i<n;i++)
    {
        ans+=a[i]/mid;
    }
    return ans>=k;
}
int main()
{
    ll a,b;while(cin>>a>>b)
    {
        ll gcd=__gcd(a,b);
        ll lcm=a*b/gcd;
        cout<<gcd<<" "<<lcm<<endl;
    }
}

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

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

int main(){
    long long a, b, g;
    while(cin >> a >> b){
        g=gcd(a, b); 
        cout << g << " " << a*b/g <<  endl;
    }
}
//g++ -o proa.exe proa.cpp

//VSCなら./test
//Atomならtest.exe

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

C++: /*
*AOJ0005 GCD and LCM
**問題
[http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005&lang=jp]
*/
#include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

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

int main() {
  // ifstream cin("../test.txt");
  int a, b, g;
  long long l;
  while (cin >> a >> b) {
    g = gcd(a, b);
    l = a * b / g;
    cout << g << " " << l << endl;
  }
}

C++: #include <iostream>

using namespace std;

int getGcd(int a, int b)
{
  while (a && b) {
    if (a > b) a %= b;
    else if (b > a) b %= a;
    else if (a == b) return a;
  }

  if (a > b) return a;
  return b;
}

int main(void)
{
  int a, b;

  while (cin >> a >> b) {
    int gcd = getGcd(a, b);
    printf("%d %d\n", gcd, a * (b / gcd));
  }

  return 0;
}

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

void compare(long int* a, long int* b){
  long int tem;
  if(*a < *b){
    tem = *a;
    *a = *b;
    *b = tem;
  }
}


int main(){
  long int a, b, k;
  long int x[1000][2];
  int n = 0;


  while(cin >> a >> b){
    k = a * b;
    while(1){
      if(a == b)
        break;
      compare(&a, &b);
      a = a - b;
    }
    x[n][0] = a;
    x[n][1] = k / a;
    n++;
  }

  for(int i = 0; i < n; i++)
    cout << x[i][0] << " " << x[i][1] << '\n';

  return 0;
}

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

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

int lcm(int a, int b)
{
  if (a == 0 || b == 0) return (0);
  return ((a / gcd(a, b)) * b);
}

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

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

long long gcd(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a == b) ? a : gcd(b % a, a);
}

long long lcm(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a / gcd(a, b)) * b;
}

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

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// GCD show
		std::cout << b << std::endl;
		
		// LCM
		long int lcm = product / b;

		//LCM show
		std::cout << lcm << std::endl;
	}
	
	return 0;
}

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

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(true){
		int tmp=a;
		a=b;
		b=tmp-b;
		if(a<b){
		b=1;
		break;
		}
		if(a-b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

long long gcd(long long a, long long b){ // Ååöñ
    if(a == 0 || b == 0)
        return 0;
    if(b > a)
        swap(a, b);
    long long tmp;
    while((tmp = a % b) != 0){
        a = b;
        b = tmp;
    }
    return b;
}

long long lcm(long long a, long long b){ // Å¬ö{
    return a / gcd(a, b) * b;
}

int main()
{
    for(;;){
        long long a, b;
        if(!(cin >> a >> b))
            return 0;
        cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
    }
}

C++: #include<stdio.h>


//公約数の関数
/**/ long long int kouyakusuu_f(/**/ long long int a,/**/ long long int b)
{
	//返す変数
	/**/ long long int kouyakusuu_ans = 0;
	/**/ long long int i = 0;

	//無限ループ
	for (i = a;;i -= 2)
	{
		//両方割れるなら
		if (a % i == 0 && b % i == 0)
		{
			kouyakusuu_ans = i;
			break;
		}
	}

	return kouyakusuu_ans;
}



//公倍数の関数
/**/ long long int koubaisuu_f(/**/ long long int a,/**/ long long int b)
{
	//保存用変数(aとbをもう入れちゃう)
	/**/ long long int hozon1 = a,hozon2 = b;
	//インクリメント変数
	int count1 = 0,count2 = 0;

	//合うまで続ける
	while (hozon1 != hozon2)
	{
		//aのほうが小さいとき(bが大きい)
		while (hozon1 < hozon2)
		{
			count1++;
			//小さいaを少しずつ増やす
			hozon1 = a * count1;
		}
		//bの方が小さいとき(aが大きい)
		while (hozon2 < hozon1)
		{
			count2++;
			//小さいbを少しずつ増やす
			hozon2 = b * count2;
		}
	}

	//どうせ同じだからどっちでも問題ない
	return hozon1;
}




int main(void)
{
	//公倍数と公約数
	/**/ long long int kouyakusuu = 0;
	/**/ long long int koubaisuu = 0;
	//入力
	/**/ long long int a = 0,b = 0;

	//回しまくる
	while (scanf("%lld %lld",&a,&b) != EOF)
	{
		//同じ値ならそのマンまでいいでしょう
		if (a != b)
		{
			//公約数を関数よりもとめる
			kouyakusuu = kouyakusuu_f(a,b);
			//公倍数を関数により求める
			koubaisuu = koubaisuu_f(a,b);
		}
		//同じ値ならそのまま
		else
		{
			koubaisuu = a;
			kouyakusuu = a;
		}
		//表示
		printf("%lld %lld\n",kouyakusuu,koubaisuu);
	}

	return 0;
}

C++: #include<stdio.h>


int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j),i){
		x=i,y=j;

		while(i==j){
			if(i>j){
				i=i%j;
			}else{
				j=j%i;
			}
		}

		y=x*y/i;
		x=i;


		printf("%lld %lld\n",x,y);
	}

	return 0;
}