Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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



int main(void){
	//GCD=?????§??¬?´???°
	//LCM=????°???¬?????°

	long int a, b,Max,Min,GCD,LCM,count;


	while (cin>>a>>b){
		count = 0;
		Max = max(a, b);
		Min = min(a, b);
		//GCD

		//????°????????????£????????£????????????????????????????????§??¬?´???°??§??????
		for (int i = 1;;i++){

			if (Min %i == 0 && Max%(Min/i)==0){//?????????????????????
				GCD = Min/i; 
				count++;
			}		
			if (count == 1)break;
		}

		//LCM

		for (int i = 1;; i++){
			if ((Max*i) % Min == 0){
				LCM = (Max*i);
				count++;
			}if (count == 2)break;
		}


		cout << GCD << " " << LCM << endl;
	
	}
	
	
	return 0;
}

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