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 <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*b/gcd(a, b);
}

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

C++: ruby 5416061-aoj-0005.rb

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
	unsigned long long a,b,c,d,maxx=1230,minn=0,m,n;
	while (cin>>a>>b){
		m=a;
		n=b;
		if (a>b){
			while(1){
				maxx=a%b;
				a=b;
				b=maxx;
				if (maxx==0){
					maxx=a;
					break;
				}
				
			}
		}
		else {
			while(1){
				maxx=b%a;
				b=a;
				a=maxx;
				if (maxx==0){
					maxx=b;
					break;
				}
			}
		}
		a=m;
		b=n;
		cout<<maxx<<" "<<a*b/maxx<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;

		while (a % b != 0){
			r = a % b;
			a = b;
			gcd = a;
			b = r;
		}

		lcm /= gcd;

		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

C++: #include <iostream>                                                                                                       
                                                                                                                          
using namespace std;                                                                                                      
                                                                                                                          
int main() {                                                                                                              
  long long int a, b, m, n, t, lcm, gcd;                                                                                  
                                                                                                                          
  while (cin >> a && cin >> b) {                                                                                          
    if (b > a) {                                                                                                          
      t = a;                                                                                                              
      a = b;                                                                                                              
      b = t;                                                                                                              
    }                                                                                                                     
                                                                                                                          
    m = a;                                                                                                                
    n = b;                                                                                                                
    while (m % n != 0) {                                                                                                  
      t = n;                                                                                                              
      n = m % n;                                                                                                          
      m = t;                                                                                                              
    }                                                                                                                     
    lcm = n;                                                                                                              
    gcd = a * b / lcm;                                                                                                    
    cout << lcm << " " << gcd << endl;                                                                                    
  }                                                                                                                       
                                                                                                                          
  return 0;                                                                                                               
}

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

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

long lcm(long a,long b){
    return a*b/gcd(a,b);
}

int main (int argc, const char * argv[])
{
    int x,y;
    while(cin>>x>>y){
    cout<<gcd(x,y)<<' '<<lcm(x,y)<<endl;
    }
    return 0;
}

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

int main()
{
    long long a, b, ba, bb;
    long long gcd, lcd = 0;
    while(cin >> a >> b)
    {
        ba = a;
        bb = b;
        while(b!=0)
        {
            gcd = b;
            b = a % b;
            a = gcd;
        }
        lcd = ba * bb / gcd;
        cout << gcd << " "<< lcd << endl;
    }
    
    return EXIT_SUCCESS;
}

C++: #include <iostream>

int main()
{
    long large, small;
    long a, b, tmp;
    while (std::cin >> a >> b) {
        if (a < b) {
            tmp = a;
            a = b;
            b = tmp;
        }
        large = a;
        small = b;
        while (small != 0) {
            tmp = small;
            small = large - (large / small) * small;
            large = tmp;
        }
        std::cout << large << " " << a * b / large << std::endl;
    }
    return 0;
}

C++: #include<stdio.h> 
long long GCD(long long int A,long long B) {
	if(B%A==0) 
		return A;
	else 
	{ 
		long long Temp=A; 
		A=B%A; 
		B=Temp; 
		return GCD(A,B); 
	} 
} 
int main() { 
	long long a,b; 
	long long n1,n2; 
	while(scanf("%lld%lld",&a,&b)!=EOF) { 
		if(a<b) 
			n1=GCD(a,b); 
		else 
			n1=GCD(b,a); 
		
		n2=a*b/n1; 
		
		printf("%lld %lld\n",n1,n2); 
	} 
}