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(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;

	}

	//getchar();

	return 0;
}

C++: #include <cstdio>

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

int main(){
	long long int a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
	    long long int c=gcd(a,b);
	    long long int d=a*b/c;
	    printf("%lld %lld\n",c,d);
	}
	return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	int a,b;
	while(cin>>a>>b){
		int lcm, gcd;
		
		int n=min(a,b);
		for(int i=n/2; i>=1; i--){
			if(!(a%i) && !(b%i)){
				gcd = i;
				break;
			}
		}
		lcm = a * (b / gcd);		//()必要。intの範囲のため
		
		cout<< gcd<< " "<< lcm<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

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

int main(){
  long a, b;
  long ca, cb, tmp;
  long gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb!=0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a*b/gcd;

    printf("%d %d\n", gcd, lcm);
  }

  return 0;
}

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

int main() {
	for(long long a, b; scanf("%lld %lld", &a, &b) == 2;) {
		long long g = __gcd(a, b);
		printf("%lld %lld\n", g, a / g * b);
	}

	return EXIT_SUCCESS;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long int a,b,n,lcm;
    while (scanf ("%lld %lld",&a,&b)!=EOF)
    {
        n=__gcd(a,b);
        lcm=(a*b)/n;
        cout<<n<<" "<<lcm<<endl;
    }
}

C++: #include <iostream>
 
typedef unsigned int ui;
 
void swap(ui & a, ui & b)
{
    unsigned int tmp = a;
    a = b;
    b = tmp;
}
 
ui gcd(ui a, ui b)
{
    if (a < b) swap(a, b);
 
    ui c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
 
    return b;
}
 
int main() {
    using namespace std;
 
    ui a, b;
    while (cin >> a >> b) {
        const ui GCD = gcd(a, b);
        const ui LCM = a * (b / GCD);
        cout << GCD << ' ' << LCM << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
int gcd(int x,int y){
	return y==0?x:gcd(y,x%y);
}
int lcm(int x,int y){
	return x/gcd(x,y)*y;
}
signed main(){
	int a,b;
	while(cin>>a>>b){
		cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
	}
}

C++: #include <iostream>			//std::cout, std::cin
#include <string>			//std::string,std::to_string(C++11)
#include <vector>			//std::vector
#include <valarray>			//std::valarray
#include <algorithm>		//std::sort
#include <ctime>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs,std::pow,sqrt,sin,cos,round,floor,ceil
#include <fstream>			//std::ifstream,std::ofstream
#include <iomanip>			//std::setprecision,std::setw,std::setfill
#include <random>			//std::random(C++11)
#include <numeric>			//std::accumulate
#include <functional>		//std::greater
#include <chrono>			//std::chrono(C++11)
#include <bitset>			//std::bitset
#include <queue>			//std::queue

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;

int Greatest_Common_Divisor(int a, int b) {

	while (a != 0 && b != 0) {
		if (a > b) {
			a = a - b;
		}
		else {
			b = b - a;
		}
	}
	return(a + b);
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	//std::ofstream ofs("456.csv");
	//std::chrono::system_clock::time_point t_st = std::chrono::system_clock::now();

	unsigned int a = 0, b = 0;
	std::vector<unsigned int> GCD, LCM;

	while (std::cin >> a) {
		std::cin >> b;
		GCD.push_back(Greatest_Common_Divisor(a, b));
		LCM.push_back(unsigned long long(a)*unsigned long long(b) / GCD.back());
	}

	for (int i = 0; i < GCD.size(); i++) {
		std::cout << GCD[i] << " " << LCM[i] << std::endl;
	}

	//std::chrono::system_clock::time_point t_ed = std::chrono::system_clock::now();
	//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t_ed - t_st).count() << "ms" << std::endl;

}

C++: int main(){
//	m*n = LCM * GCD
	unsigned long long m, n;
	while(cin >> m >> n){
		int LCM, GCD;
		
		if(m<n){
			int swap;
			swap = m;
			m = n;
			n = swap;
		}

		int m_, n_;
		m_ = m;
		n_ = n;
		do {
			if(n_==0){
				GCD = m_;
				break;
			}
			
			int swap = m_ % n_;
			m_ = n_;
			n_ = swap;
		} while(1);
		
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	return 0;
}

C++: #include<stdio.h>
long long fan(long long a,long long b)
{
    if(b==0)
        return a;
    else
        return fan(b,a%b);
}
int main()
{
    long long a,b;
    while(scanf("%lld%lld",&a,&b)!=EOF)
    printf("%lld %lld\n",fan(a,b),a/fan(a,b)*b);
    return 0;
}

C++: import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a,b;
		while(true){
			a = cin.nextInt();
			b = cin.nextInt();
			System.out.println(gcd(a,b)+" "+lcm(a,b));
		}
	}

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

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long r=1;
	while(1){
		r=a%b;
		if(r==0)break;
		a=b;
		b=r;
	}
	return b;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int gcd(int x, int y)
{
	if (x%y == 0)
		return y;
	if (x < y)
		swap(x, y);
	return gcd(y, x%y);
}
int main()
{
	int n, m;
	while (scanf("%d %d", &n, &m)!=EOF);
	{
		cout << gcd(n, m) <<" "<< n / gcd(n,m) * m << endl;
	}
}

C++: #include<iostream>
using namespace std;
long long gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  while(cin>>a>>b){

  c=gcd(a,b);
  d=a*(b/c);
  cout<<c<<' '<<d<<endl;
  }
  return 0;
}

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