Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include <iostream>
using namespace std;
int main(void)
{
    unsigned int a, b;
    while (cin >> a >> b)
    {
        int t = 1, g = 1;
        unsigned int l = 1;
        if (a < b)
        {
            while (t < b)
            {
                if (a % t == 0 && b % t == 0)
                {
                    g = t;
                }
                t++;
            }
            a = a / g;
            b = b / g;
            l = g * a * b;
        }
        else
        {
            while (t < a)
            {
                if (a % t == 0 && b % t == 0)
                {
                    g = t;
                }
                t++;
            }
            a = a / g;
            b = b / g;
            l = g * a * b;
        }
        cout << g << ' ' << l << endl;
    }
}

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