Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: #include <stdio.h>

int main(){

	int a = 0, s = 0, d = 0, f = 0, A = 0, S = 0;


		A = a;
		S = s;

		if (a < s){
			d = a;
			a = s;
			s = d;
		}
		while (1){
			if (s == 0){ break; }
			f = a%s;
			a = s;
			s = f;
		}

		printf("%d ", a);

		printf("%d\n", A*S / a);
	

	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 (1){
			r = a % b;

			if (r == 0){
				break;
			}

			gcd = r;
			a = b;
			b = r;
		}

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

	return 0;
}

C++: #include<iostream>

int main(){
	int a,b;
	
	while( cin >> a >> b ){
		int num1 = a;
		int num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		
		while( (int gcd = num1%num2) != 0){
			num1 = num2;
			num2 = gcd;
		}
		gcd = num2;
		int lcm = a / gcd * b;
		cout << gcd <<" "<< lcm << "\n";
	}
	
	return 0;
}

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 >= 1; 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 <cstdio>
#include <iostream>

using namespace std;

int gcd(int,int);

int main()
{
	int a,b,GCD,LCM;

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

		LCM = (a*b) / GCD;

		printf("%d %d\n",GCD,LCM);
	}

	return 0;
}

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

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

using namespace std;

long long a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); ++i)

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

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<cstdio>
using namespace std;

int main()
{
	int a, b;
	while (cin >> a >> b)
	{
		int x = a, y = b;
		while (a%b != 0)
		{
			int r = a%b;
			a = b;
			b = r;
		}
		cout << b << " " << x / b*y / b*b << endl;
	}
	return 0;
}

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

int main() {
	long long a, b;
	while (cin>>a>>b) {
		long long G=a,L=b;
		if (G < L)swap(G, L);
		while (G%L != 0) {
			G = G - L*(G/L);
			if(G < L)swap(G, L);
			//cout<<G<<" "<<L<<endl;
		}
		G=min(G,L);
		L=a*b/G;
		cout << G << " " << L << endl;
	}
	return 0;
}

C++: #include<cstdio>
#define MAX(x,y) ((x>y)? x:y)
#define MIN(x,y) ((x<y)? x:y)

long long int a,b,g,h;

int f(long long int x,long long int y)
{
	if(y==0) return x;
	else return f(y,x%y);
}

int main()
{
	while(scanf("%ld%ld",&a,&b)!=EOF)
	{
		g = f(MAX(a,b),MIN(a,b)); 
		h = (a/g)*b;
		printf("%ld ",g);
		printf("%ld\n",h);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))

template<typename TYPE>
TYPE gcd(TYPE x, TYPE y){
	TYPE r = x % y;
	if (r == 0.0) return y;
	else return gcd(y, r);
}

template<typename TYPE>
TYPE lcm(TYPE x, TYPE y){
	return x * y / gcd(max(x, y), min(x, y));
}

int main()
{
	long long int x, y;
	while (cin >> x >> y){
		cout << gcd(max(x, y), min(x, y)) << ' ' << lcm(x, y) << "\n";
	}
	cout.flush();
	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/ret_gcd)*j;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

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

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

int main(){
  long long a, b;
  while(cin >> a >> b){
    long long gcd = __gcd( a, b);
    cout << gcd << " " << ( a * b ) / gcd << endl;
  }
}

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

int main()
{
    long long int a,b,c,d,tmp=0;
    
    while(cin >> a >> b){
        if (a<b) {
            swap(a,b);
        }
        
        c = a;
        d = b;
        
        while (b) {
            tmp = b;
            b = a % b;
            a = tmp;
        }
        
        cout << a << " " << c*d/a << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b;cin>>a>>b;cout<<__gcd(a,b)<<" "<<a/__gcd(a,b)*b<<endl;return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#define MAX 500000
using namespace std;

int p[MAX];

int main()
{
	//素数
	fill(p, p + MAX, 1);
	for (int i = 2; i < MAX; i++){
		int sqrti = (int)sqrt(i);
		for (int j = 2; j <= sqrti; j++){
			if (i % j == 0){
				p[i] = 0;
				break;
			}
		}
	}

	long long int a, b;
	while (cin >> a >> b){
		long long int gcm = 1;
		bool flag = true;
		while (flag){
			for (int i = 2;; i++){
				if (p[i] == 1 && a % i == 0 && b % i == 0){
					gcm = gcm * i;
					a = a / i;
					b = b / i;
					break;
				}
				if (i == min(a, b)){
					flag = false;
					break;
				}
			}
		}
		long long int lcm = gcm * a * b;
		cout << gcm << " " << lcm << endl;
	}
	return 0;
}

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

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

int main(){
  long long int a, b;

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

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

using namespace std;

/*Assumption:a > b*/
int gcd(int a, int b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

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

int main() {
  int a, b, c;
  while(cin >> a >> b) {
    //    swap(a, b);
    c = gcd(a, b);
    cout << c << ' ' << lcm(a, b, c) << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    }

}

C++: #include<stdio.h>
typedef unsigned long long ullong;

ullong gcm(ullong a,ullong b){
    ullong m = a%b;
    while(m){
        a = b;
        b = m;
        m = a%b;
    }
    return b;
}

int main(){
  ullong a,b,g;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    g = gcm(a,b);
    printf("%lld %lld\n",g,(a*(b/g)));
  }
}