Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

C++: #include<cstdio>
long long gcd(long long a,long long b)
{
	if(b==0LL)
		return a;
	return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(~scanf("%lld%lld",&a,&b))
	{
		long long d=gcd(a,b);
		printf("%lld %lld\n",d,a/d*b);
	}
	return 0;
}

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

long long gcd (long long a, long long b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%ld %ld", &a, &b) == 2) {
    long long g = gcd(a, b);
    printf("%ld %.3lf\n", g, a * b / g);

  }

  return 0;
}

C++: #include <iostream>
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(void){
    long long a, b;
    while(cin >> a >> b){
        long long s = gcd(a, b);
        cout << s << " " << a*b/s << endl;
    }
    return 0;
}

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

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

int main(){
	long long a,b;
	vector<long long*> output;
	while(!cin.eof()){
		cin >> a >> b;
		long long g[2];
		g[0] = gcd(a,b);
		g[1] = a*(b/g[0]);
	}
	vector<long long*>::iterator it = output.begin();
	for(;it != output.end();++it)
		cout << (*it)[0] << " " << (*it)[1] << endl;

	return 0;
}

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

int main() {
	unsigned long a, b, mod, big, small;
	while (cin >> a >> b) {
		if (a > b) {
			int stock = a;
			a = b;
			b = stock;
		}
		big = a;
		small = b;
		while (a % b != 0) {
			mod = a % b;
			a = b;
			b = mod;
		}
		cout << b << " " << big / b * small << endl;
	}
}

C++: #include <iostream>

using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
    return b>0?gcd(b,a%b):a;
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}
int main()
{
    ll a,b;
    while ((cin>>a>>b)>0)
    {
        ll GCD=gcd(a,b);
        cout<<GCD<<" "<<a/GCD*b<<endl;
    }
    return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	int a,b;
	while(cin>>a>>b){
		int lcm, gcd;
		
		int n=min(a,b);
		if(!(a%n) && !(b%n)){
			gcd = n;
		}else{
			for(int i=n/2; i>=1; i--){
				if(!(a%i) && !(b%i)){
					gcd = i;
					break;
				}
			}
		}
		lcm = a * (b / gcd);		//()必要。intの範囲のため
		
		cout<< gcd<< " "<< lcm<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
	long a, b;
	long ans[2];
	while (cin >> a >> b) {
		if (a > b) {
			long temp = a;
			a = b;
			b = temp;
		}

		long i = 1;
		while ( (b * i) % a != 0 ) {
			i++;
		}
		ans[1] = b * i;

		long n = b, m = a, r = 1;

		while (r!=0){
			r = n % m;
			n = m;
			m = r;
		}
		ans[0] = n;

		cout << ans[0] << " " << ans[1] << endl;
	}
}

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

typedef long long LL;

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

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

int main()
{
    int a, b;
    while(~scanf("%d%d",&a,&b))
    {
        int g = gcd(a,b);
        LL l = lcm(a,b,g);
        printf("%d %lld\n",g,l);
    }
    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==0)&&(j==0)){
			if(i>j){
				i=i%j;
			}else{
				j=j%i;
			}
		}
		if(i==0){
			y=x*y/j;
			x=j;

		}else{
			y=x*y/i;
			x=i;
		}

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

	return 0;
}

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

long long int gcd(long long int x,long long int y) {
  if(y == 0) return x;
  else {
    return gcd(y,x % y);
  }
}
int main() {
  long long int a,b;
  while(cin >> a >> b) {
    cout << gcd(a,b) << " " << a * b / gcd(a,b) << endl;
  }
}

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

using namespace std;

int max(int x, int y){
        int r;

        while((r = x % y) != 0){
                x = y;
                y = r;
        }
        return y;
}

long long int small(long long int x,long long  int y, int r){
        if(x * y % r  == 0)
                return x * y / r;
        else
                return x * y;
}       

int main(){
        int x,y,r;

        while((scanf("%ld %ld",&x,&y)) != EOF){
                if(x < y){
                        int num = y;
                        y = x;
                        x = num;
                } 
                cout << max(x,y) << " " << small(x,y,max(x,y)) << endl;
        }
}

C++: 
#include <iostream>
#include <algorithm>
#include <string.h>
#include <math.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

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

int a,b;

int main()
{
    while (~scanf("%d%d",&a,&b)) {
        int x=gcd(a,b);
        int y=1ll*a*b/x;
        printf("%d %d\n",x,y);
    }
}

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

int main()
{
	unsigned long long iNumA, iNumB, iGCD, iLCM, iGCDTemp, iGCDTempL, iLCMTempA[2048], iLCMTempB[2048], iCount, i, j, k;
	bool      TrueFlag;

	while( cin >> iNumA >> iNumB ){

		iGCDTempL = 0;
		iGCDTemp  = iNumB;

		while( iGCDTemp != 0 ){

			iGCDTempL = iGCDTemp;
			iGCDTemp  = iNumA % iGCDTemp;

		}

		iGCD     = iGCDTempL;
		iCount   = 1;
		i	     = 1;
		TrueFlag = false;

		while( 1 ){

			for( j = 1; j <= 2048; j++ ){

				iLCMTempA[j-1] = iNumA * j;
				iLCMTempB[j-1] = iNumB * j;

			}

			for( j = 0; j < 2048; j++ ){

				for( k = j; k < 2048; k++ ){

					if( iLCMTempA[j] == iLCMTempB[k] ){

						iLCM     = iLCMTempA[j];
						TrueFlag = true;
						break;

					}

				}

				if( TrueFlag == true ) break;

			}

			if( TrueFlag == true ) break;

		}

		cout << iGCD << ' ' << iLCM << endl;

	}

	return 0;
}

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

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

	while(scanf("%d%d", &a, &b)!=EOF){
		B = b;

		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			if (b == 0){
				printf("0 ");
				break;
			}

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		if (b == 0){
			printf("%d\n", a);
		}
		else{
			m = a / b;/*/公倍数*/
			m *= B;
			printf("%d\n", m);
		}
	}

	return 0;
}