Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			break
		}
		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
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

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

long LCM(long a, long b){
	return a*b / GCD(a, b);
}

int main()
{
	long a,b;
	while(cin >> a >> b){
		cout << GCD(a,b) << " " << LCM(a,b) << endl;
	}
}

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

int main() {
	long a,b,G;
	cin>>a>>b;
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
}

C++: #include <iostream>
 
 
using namespace std;
 
int main() {
 
    long ain,bin;
    long c,d,e,gcm,lcd;
     
    cin >> ain >> bin;
    if (ain < bin) {
        c = ain;
        ain = bin;
        bin = c;
        c=0;
    }
 
    c=ain;
    d=bin;
 
    for(;;) {
        if(d==0) {
            gcm = c;
            lcd = ain * bin / gcm;
            break;
        }
        e = c % d;
        c = d;
        d = e;
    }
 
    cout << gcm << " " << lcd << endl;
 
 
    return 0;
}

C++: 
#include <stdio.h>

int main(){
    long a, b, r, lcm, x, y;
    while (scanf("%ld %ld",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%-ld %-ld\n",y,lcm);
    }
    
    return 0;
}

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

int main(){

int small,big,i,c,kouyaku,koubai;

while(cin >> small >> big){

if(small>big){//大小比較
c=big;
big=small;
small=c;
}

for(i=1;i<=big;i++){//最大公約数
if(big%i==0 && small%i==0)kouyaku=i;
}

for(i=1;i<=small;i++){//最小公倍数

if((big*i)%small==0){
koubai=big*i;
break;
}
}

cout << kouyaku << " " <<koubai << endl;//出力
}
return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    long long int flag,a1,b1,t,k,a,b;
    while(cin>>a>>b){
		if(a==b){
			cout<<'1'<<" "<<a<<endl;
			continue;
		}
    	a1=a,b1=b;
		if(a<b)
			t=a,a=b,b=t;
		k=a%b;
		while(k){
			a=b;
			b=k;
			k=a%b;
		}
		cout<<b<<" "<<(a1/b)*b1<<endl;
    }
}

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

//aとbの最大公約数と最小公倍数を求める。
void Euclidean(const long a, const long b, long& divisor, long& multiple);

int main(void) {
    long a, b;
    long divisor, multiple;
    
    while(cin >> a >> b) {
        Euclidean(a, b, divisor, multiple);
        cout << divisor << ' ' << multiple << endl;
    }
}

void Euclidean(const long a, const long b, long& divisor, long& multiple) {
    long L, S, n;
    if(a > b) { L = a;   S = b; }
    else      { L = b;   S = a; }
    while((L % S) != 0) {
        n = L;
        L = S;
        S = n % S;
    }
    divisor = S;
    multiple = a * b / divisor;
}

C++: #include <iostream>
//include <algorithm>
using namespace std;
int gcd( int a, int b ){
	if( b == 0 ){
		return a;
	}else{
		return gcd( b, a % b );
	}
}
int lcm( int a, int b ){
	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 <iostream>
using namespace std;

int main(){

	int a,b,GCD,LCM,c;

	while(cin>>a>>b){

		if(a>b){
			c=a;
		}
		else{
			c=b;
		}

		for(int i=1;i<=c;i++){
			if(b%i==0 && a%i==0){
				GCD = i;
			}
		}
		LCM=a*b/GCD;
		cout<<GCD<<" "<<LCM<<endl;
	}

	return 0;
}

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

int saidai(long  a,long  b){
	while(b != a){
		if(a > b){
			a -= b;
		}else {
			b -= a;
		}
	}
	return a;
}


long long	saisyou( long  a,long b , long c){
	return a/c*b;
}

int main(){
	long  a,b;
	cin>>a;
	cin>>b;
	long long ans = saidai(a,b);
	cout<<ans<<" "<<saisyou(a,b,ans)<<endl;;
	return 0;

}

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

using namespace std;
 
int saidai(int a, int b);
int saisho(int a, int b);

int main(){
	int a, b;

	while(cin >> a >> b){
		if(a<b) swap(a,b);
		
		cout << saidai(a, b) << " " << saisho(a,b) << endl;
	}
}

int saidai(int a, int b){
	
	int x=1;
	for(int i=2; i<=a; i++){
		while(1){
		if(a%i == 0 && b%i == 0){
			 x = x * i;
			 a =a/i;
			 b =b/i;
		}
		 else break;
		}
	}

	return x;
}

int saisho(int a, int b){

	int y=1;
	for(int i=2; i<=a; i++){
		while(1){
		if(a%i == 0 && b%i == 0){
			 y = y * i;
			 a =a/i;
			 b =b/i;
		}
		 else break;
		}
	}

	y = y * a * b;

	return y;
}

C++: #include <iostream>

int GCD(int a, int b) {
	int
		c = std::max(a, b),
		d = std::min(a, b);
	while (c != d) {
		c -= d;

		int tmp[] = {c, d};
		c = std::max(tmp[0], tmp[1]);
		d = std::min(tmp[0], tmp[1]);
	}

	return c;
}

int main() {
	int a, b;
	while (std::cin >> a >> b) {
		int gcd = GCD(a, b);
		int lcm = a * b / gcd;
		std::cout << gcd << " " << lcm << std::endl;
	}
}

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

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}

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

C++: #include <iostream>

using namespace std;

int gcd(int x, int y) {
    if(x<y) return gcd(y,x);
    if(y==0) return x;
    return gcd(y, x%y);
}


int main() {
    int a, b;
    while(true) {
        cin >> a;
        if(cin.eof()) break;
        cin >> b;
        int g=gcd(a, b);
        cout << g << " " << (a/g)*b << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    int a,b;

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

        for(int i=2;i<=((a<b)? b:a);i++){
            if((a%i==0)&&(b%i==0)) gcd=i;
        }

        printf("%d %d\n",gcd,(int)((long)a*b/(long)gcd));
    }

    return 0;
}

C++: #include<iostream>
#include<utility>
using namespace std;
int main()
{
  long long int n=0,m=0;
  long long int i=0,j=0,l=0;

  while(scanf("%d %d",&n,&m) != EOF)
    {
      i = n;
      j = m;

      //koyaku
      if((n >= m) != true)swap(n,m);
      while(1)
	{
	  int amari = n % m;
	  n = m;
	  m = amari;
	  if(amari == 0) break;
	}
      
      //kobai
      l = i*j/n;
      
      cout << n << " " << l << endl;
    }
}

C++: #include <stdio.h>

int gcd(int,int);

int main(void){
	long a,b;
	long divi,multi;
	while(scanf("%ld %ld",&a,&b) != EOF){
		divi = gcd(a,b);
		multi = a*(b / divi);
		printf("%ld %ld\n",divi,multi);
	}
	return 0;
}

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