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 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>

int  main() {

	//?????§??¬?´???° =????????????????????????????????????
	/*(1) a ??? b ??§???????????????????????? r ?????\????????????
	???(2) r ??? 0 ?????? b ????????§??¬?´???°??§?????????????????????????????????
	???(3) ????????§????????¨????????°a = b?????°b = r ??¨?????? (1) ???????????????????????????*/

	 //????°???¬?????° =???a*b???/???a??¨b????????§??¬?´???°?????§?±?????????????
	int a = 0, b = 0, ad = 0, bd = 0, swap, amari, koba = 0;
	std::cin >> a >> b;
	ad = a; bd = b;
	if (b >= a) { swap = a; a = b; b = swap; }
		
	a:
		amari = a%b;
		if (amari == 0) {
			std::cout << b << " ";
			std::cout << ad*bd / b << std::endl;
		}
		else {
			a = b;
			b = amari;
			goto a;
		}
}

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

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

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

C++: #include<iostream>
int e(int a,int b){if(a<b)a^=b^=a^=b;while(a%=b)a^=b^=a^=b;return b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%ld %ld\n",c,a/c*b))c=e(a,b);}

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=min(a, b)/2;i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
    int GCD = find_GCD(a, b);
    int LCM = a*b/GCD;
    cout << GCD << " " << LCM << endl;
  }

}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int calc(int a, int b) {
	if (!b)return a;
	return calc(b, a%b);
}
int main() {
	int a, b;
	while (cin >> a >> b) {
		int gcd = calc(max(a, b), min(a, b));
		a /= gcd; b /= gcd;
		cout << gcd << ' ' << gcd*a*b << endl;
	}
	return 0;
}

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

int main(void);
int gcd(int x, int y);
int lcm(int x, int y);

int main(){
	int dataset_count = 0;
	int first_num = 0;
	int second_num = 0;

	std::vector<int> first_num_vector;
	std::vector<int> second_num_vector;

	while ((std::cin >> first_num >> second_num) || (dataset_count < 50)){
		dataset_count++;
		first_num_vector.push_back(first_num);
		second_num_vector.push_back(second_num);
	}
	for (int i = 0; i < first_num_vector.size(); i++){
		std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl;
	}
	return 0;
}


// 最大公約数を求める関数
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

//	最小公倍数を求める関数
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	return (x * y / gcd(x, y));
}

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

#define MAX 256

int main(void){
	
	long max[50], min[50];
	for (long i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	long a, b;
	long i = 0;

	while (scanf("%d%d", &a, &b) != EOF){
		while (max[i] == 0){
			for (long j = a; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		long j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (long j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

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

using namespace std;

int main()
{
	int  a, b, a1, b1, c, g;
	long l;
	
	while (cin>>a>>b)
	{
		a1 = a;
		b1 = b;
		if (a == 0 || b == 0)
		{
			break;
		}
		while (1)
		{
			c = abs(a - b);
			if (c == 0)
			{
				break;
			}

			if (a > b)
			{
				a = c;
				g = c;
			}
			else if (a < b)
			{
				b = c;
				g = c;
			}
		}
		l = (a1 / g)*b1;
		cout << g << " " << l << endl;
		
		a1 = a; b1 = b;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
  for(int i = 0; i < 55; i++){
    int a = 0, b = 0, gcd, lcm;
    cin >> a >> b;

    if(a == 0 && b == 0){
      break;
    }
    else{
      int A = max(a, b), B = min(a, b);
      int r = A % B;
      while(r != 0){
        A = B;
        B = r;
        r = A % B;
      }
       gcd = B;

       lcm = gcd * (a / gcd) * (b / gcd);
    }
    cout << gcd << " " << lcm << endl;
  }
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i*i >= a; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

using namespace std;

typedef long long ll;

template<class T>
T gcd(T a,T b){
	while(a % b != 0){
		T buf = b;
		b = a%b;
		a = buf;
	}
	return b;
}

int main(){
	ll a,b;
	while(cin>>a>>b){
		ll g = gcd(a,b);
		ll l = a / g * b;

		cout << g << " " << l << endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	
	int a, b;
	int temp;
	int big, small;
	
	while(cin>>a>>b){
		
		if(a < b){
			big = b;
			small = a;
		}
		else{
			big = a;
			small = b;
		}
		
		for(;;){
			temp = big % small;
			if(temp == 0){
				break;
			}
			if(temp > small){
				big = temp;
			}
			else{
				big = small;
				small = temp;
			}
		}
		cout << small <<" "<< a/small*b << endl;
	}
}

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

using namespace std;

void swap(long *a, long *b){
	long tmp= *a;
	*a = *b;
	*b = tmp;
}

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

long lcm(long x, long y){
	return (x*y/gcd(x,y));
}

int main(){
	long a, b;
	while( scanf(" %ld %ld", &a, &b) != EOF ){
		printf("%ld %ld\n", gcd(a,b), lcm(a,b));		
	}

	return 0;
}

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

int gcd(int a,int b){

    if(b==0) return a;

    return gcd(b,a%b);
}

int main(){
    while(true){
        int a,b;
        cin>>a>>b;

        if(cin.eof()) break;

        int g =gcd(a,b);
        cout<<g<<' '<<a/g*b<<endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}