Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d\n", G, L)
	}
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	int a[2];
	int tmp;
	int GCD = 1;
	int LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		for (size_t i = 1; i < a[0]; i++)
		{
			if (a[0] % i == 0 && a[1] % i == 0)
			{
				GCD = i;
			}
		}

		// ????°???¬?????°????¨????
		for (size_t i = 1;; i++)
		{
			if (i*a[1] % a[0] == 0) {
				LCM = i*a[1];
				break;
			}
		}
		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int main(void){
    int a, b, c, d, tmp;
        scanf("%d %d", &a, &b);
     d = a * b;
    if(a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
     c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
        printf("%d %d\n", b, d / b);
            return 0;
}

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

int main(void)
{
  long long unsigned int a, b, x, y, gcd, lcm, r;

  while(scanf("%llu %llu", &a, &b) != EOF)
    {
      r = 1;
      x = a;
      y = b;

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

      lcm = a * b / gcd;

      cout << gcd << " " << lcm << endl;
    }
  return 0;
}

C++: #include<iostream>

int main(){
	int a[44722],b,c,d,e=0,f=1;
	while(std::cin >> b >> c){
	for(d=2;d*d<=b||d*d<=c;){
		if(b%d==0&&c%d==0){
			a[e] = d;
			e++;
			b = b / d;
			c = c / d;
		}else break;
	}
	for(d=3;d*d<=b||d*d<=c;d=d+2){
		while(1){
			if(b%d==0&&c%d==0){
			a[e] = d;
			e++;
			b = b / d;
			c = c / d;
			}else break;
		}
	}
	a[e] = 0;
	for(e=0;a[e]>0;e++){
		f = f * a[e];
	}
	std::cout << f;
	f = f * b * c;
	std::cout << " " << f << std::endl;
	e = 0;
	f = 1;
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int x=a,y=b;
		while(true){
			if(x==y)
				break;
			if(x>y)
				x-=y;
			else if(y>x)
				y-=x;
		}
		cout<<x<<" ";
		int keep=x;
		x=a/keep;
		y=b/keep;
		cout<<x*y*keep<<endl;
	}
	return 0;
}

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

unsigned GCD(unsigned a, unsigned b)
{
	unsigned s=(a<b)?a:b, l=(a<b)?b:a;
	unsigned gcd=1;
	for(unsigned i=2; i<=s; ++i)
	{
		while(s%i==0 && l%i==0)
		{
			s/=i;
			l/=i;
			gcd*=i;
		}
	}
	return gcd;
}

unsigned LCM(unsigned a, unsigned b)
{
	unsigned large = (a<b)?b:a;
	unsigned x = large;
	for(unsigned i=1; x<2000000000; ++i)
	{
		if(x%a==0 && x%b==0)
		{
			return x;
		}
		x+=large;
	}
}

int main()
{
	double a,b;
	while(cin>>a>>b)
	{
		cout << GCD(a,b) << ' ' << LCM(a,b) << '\n';
	}
}

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

//max 
long int gcd(long int a, long int b){
    if((a==0 || b==0)) return 0;
    while(a!=b){
        if(a>b) a=a-b;
        else b=b-a;
    }
    return a;
}

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

C++: #include"iostream"
using namespace std;

int main()
{
	int a,b,gcd,lcm;
	while (cin >> a >> b)
	{
		for (int i = a; i > 0; i--)
		{
			if (b%i == 0&&a%i==0)
			{
				gcd = i;
				break;
			}
		}
		for (int j = a;; j++)
		{
			if (j%a == 0 && j%b == 0)
			{
				lcm = j;
				break;
			}
		}
		cout << gcd << " " << lcm << endl;
	}
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	if(a==0||b==0){
	
	}
	else 
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
	}
		
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int gcd(int a,int b){
	int n;
	n = a%b;
	if (n == 0)return b;
	else return gcd(b, n);
}
int main() {
	int a, b, c, n,s;
	while (cin >> a >> b) {
		if (a > b)n = gcd(a, b);
		else n = gcd(b, a);
		s = a / n*b;
		cout << n << " " << s << endl;
	}
	return 0;
}

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

int lcm(int n, int m) {
    if (n < m) swap(n, m);
    if (m == 0)
        return n;
    else
        return lcm(m, n % m);
}

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

C++: #include<iostream>

using namespace std;

int main(){
	int a,b,ta,tb,tc;
	while(cin >> a>>b){
		ta=a;
		tb=b;
		while(1){
			if(ta<tb){
				tc=ta;
				ta=tb;
				tb=tc;
			}
			tc=ta%tb;
			if(tc==0)break;
			ta=tb;
			tb=tc;
		}
		cout << tb<< " "<< a*b/tb <<endl;
	}
	return 0;
}

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

inline u_long lcm(const u_long a, const u_long b) {
    return a * b / std::__gcd(a, b);
}

int main(void) {
    u_long a, b;

    while (std::cin >> a >> b) {
        std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl;
    }

    return 0;
}