Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	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 <cstdio>

unsigned gcd(unsigned a, unsigned b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  while (a % b != 0) {
    unsigned t = a;
    a = b;
    b = t % b;
  }
  return b;
}

int main() {
  unsigned a, b;
  while (!feof(stdin)) {
    scanf("%d %d", &a, &b);
    unsigned d = gcd(a, b);
    unsigned m = a / d * b;
    printf("%d %d\n", d, m);
  }
  return 0;
}

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

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

int LCM(int x,int y)
{
  return x * y / GCD(x,y);
}



int main(void)
{
  int a,b,k;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	 k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

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

long gcd(long a, long b) {
	return a % b == 0 ? b : gcd(b, b % a);
}

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

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

int main(void) {
    int a = 0;
    int b = 0;
    int originalA;
    int originalB;

    int mod;

    while (cin >> a) {
        cin >> b;
        originalA = a;
        originalB = b;

        while (true) {
            mod = a % b;
            if (mod == 0) {
                break;
            }
            a = b;
            b = mod;
        }
        cout << b << " " << (originalA / b)  * originalB << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    int a,b;
    int lcm,gcd;
    while(cin >> a >> b){
    if(a>b){
        for(int i=1;i<b;i++){
            if(b%i==0 && a%i==0){
                lcm=i;
            }
        }
        gcd=a / lcm * b;
    }
    else if(a<b){
        for(int i=1;i<a;i++){
            if(a%i==0 && b%i==0){
                lcm=i;
            }
        }
        gcd=b / lcm * a;
            
    }
    else{
        lcm=a;
        gcd=a;
    }
    
    cout << lcm <<  " " << gcd << endl;
    }

}

C++: #include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	 long GCD=0,LCM=0,a=0,b=0,xb=0,xa=0,r = 0,i=0;
	//while(scanf("%d %d",a,b)){
	while(cin>>a>>b){
    xa=a;
    xb=b;
		if(a==0 || b== 0){continue;}
		while(1){
			if(b==a){break;
			}
			if(a>b){
			a = a-b; 
			}
			else if(a<b){
			b = b-a;
			}
			
		}
		GCD=b;
		LCM=(xa*xb)/b;
		cout<<GCD<<" ";
		cout<<LCM;
		printf("\n");
		GCD=0;LCM = 0;xa = 0;xb = 0;a = 0;b = 0;
	}

	return 0;

}

C++: #include<iostream>

int GCD(int a,int b){
	while(b!=0){
		int c=b;
		b=a%b;
		a=c;
	}
	return a;
}

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

C++: #include<iostream>
#include<stdio.h>
#pragma warning(disable : 4996)
using namespace std;
typedef long long ll;
ll N, M;
ll GCD(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	else {
		return GCD(b, a%b);
	}
}
int main() {
	while (scanf("%d%d",&N,&M)!=EOF)
	{
		int ans =GCD(N, M);
		cout << ans << " " << N * M / ans<<endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}

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

int main(){
	long int ggd[200],num1,num2,lcm[200];
	int a,b;
	int i=0;
	
	while(cin >> a >> b){
		num1 = a;
		num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		
		while( (ggd[i]=num1%num2) != 0){
			num1 = num2;
			num2 = ggd[i];
		}
		ggd[i] = num2;
		lcm[i] = a / ggd[i] * b;
		i++;
	}
	
	for(int j=0; j<i; j++)
		cout << ggd[j] <<" "<< lcm[j] << "\n";
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>

using namespace std;
int main() {
	long long int n, m,nn,mm;
	while (cin >> n >> m) {
		nn = n; mm = m;

		if (nn < mm) {
			int swap = nn;
			nn = mm;
			mm = swap;
		}

		int k;
		k = nn%mm;

		while (k != 0) {
			nn == mm;
			mm = k;
			k = nn%mm;
		}
		cout << mm << " ";

		int countn = 1, countm = 1;

		while (1) {
			if (n*countn < m*countm) {
				countn++;
				if (n*countn == m*countm) {
					cout << n*countn << endl;
					break;
				}
			}
			else if (n*countn > m*countm) {
				countm++;
				if (n*countn == m*countm) {
					cout << n*countn << endl;
					break;
				}
			}
			else {
				cout << n*countn << endl;
				break;
			}
		}
	}
	
	
	return 0;
}

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

long GCD(long, long);
long LCM(long, long);

int main()
{
    long a,b;
    while(std::cin >> a >> b)
    {
        if(a < b)
        {
            std::swap(a,b);
        }
        
        std::cout << GCD(a,b) << " ";
        std::cout << LCM(a,b) << std::endl;
    }
    return 0;
}

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

long LCM(long a, long b)
{
    if(a == 0 || b == 0) return 0;
    return (a * b / GCD(a,b));
}

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


using namespace std;

int GCD(int a, int b);

int main()
{
  int a,b;
  while(cin >> a >> b)
  {
    if(a>b)
        swap(a,b);
    int x = GCD(a, b);
    cout << x << " " << (a/x)*b << endl;
  }
   return 0;
}

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

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

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

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

int main(){
  int x,y;
  while(scanf("%d %d",&x,&y)!=EOF)
    cout<<gcd(x,y)<<" "<<lcm(x,y,gcd(x,y))<<endl;
  return 0;
}

C++: #include <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
   lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(1){
    if(a==1) return b;
    else     return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(i>a/2) i = a;
    else if(i>b/2) i = b;
    
    if(a%i==0){
      if(b%i==0){break;}
      else{i++;}
    }else{
      i++;
    }
  }
  return i;
}

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

long a, b, g;

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

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

C++: #include <iostream>
using namespace std;
int main(){
int a,b,i;
while(cin>>a>>b){
int max=0,min;
i=a;
while(max==0){
if(a%i==0 && b%i==0){
max=i;}
i=i-1;}
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}