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>
#include <algorithm>
using namespace std;
int gcd (int a, int b) {
	for (;;) {
		if (!(a %= b)) return b;
		if (!(b %= a)) return a;
	}
}
int main () {
	int a, b, n, m;
	while (cin >> a >> b) {
		m = (n = gcd (a, b)) ? a/n*b : 0;
		cout << n << " " << m << endl;
	}
}

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(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

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

C++: #include<cstdio>
int g(int x,int y){
	if(y==0)return x;
	return g(y,x%y);
}

int main(){
	int a,b;
	while(~scanf("%d%d",&a,&b))printf("%d %d\n",g(a,b),a/g(a,b)*b);
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

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

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

long gongyueshu(long a,long b);
int  main()
{
	long  a,b,c,d;
	 while(scanf("%d %d",&a,&b)!=EOF)
	 

	{
	

	c=gongyueshu(a,b);
	d=a/c*b;
	
	cout<<c<<" "<<d<<endl;

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

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

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

int main(){
  int a,b;
  while(scanf("%d%d",&a,&b)!=EOF)
    printf("%d %d\n",getGcd(a,b),a/getGcd(a,b)*b);
}

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

int main(){
	int a,b;
	int i=1;
	int j=1;
	while(cin>>a>>b){
		while(1){
		if(a%i!=0){
			i++;
			continue;
		}
		if(b%j!=0){
			j++;
			continue;
		}
		if(a/i<b/j){
			j++;
			continue;
		}
		if(a/i>b/j){
			i++;
			continue;
		}
		if(a/i==b/j){
		cout<<a/i<<" ";
		break;
		}
	}
	
	i=1;
	j=1;
	while(1){
	if(a*i<b*j){
		i++;
		continue;
	}
	if(a*i>b*j){
		j++;
		continue;
	}
	if(a*i==b*j){
		cout<<a*i<<endl;
		break;
	}
	}
	}
return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;
	int x, y;

	while (cin >> a >> b){
		x = a;
		y = b;
		if (b > a){
			c = a;
			a = b;
			b = c;
		}

		while(1){
			r = a % b;
			if (r == 0){
				break;
			}
			a = b;
			b = r;
		}
		gcd = b;
		x /= gcd;
		y /= gcd;

		cout << gcd << " " << x * y * gcd << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

typedef long long ll;
ll gcd(ll a, ll b){
  return (b > 0)? gcd(b, a %b):a ;
}
int main(){
  ll a, b;
  while(cin >> a >> b){
    ll _gcd = gcd(a, b);
    cout << _gcd << " " << a*b/_gcd << endl;
  }
  return 0;
}

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

int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

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

    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

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

signed main(){
	int a, b;
	while(cin >> a >> b){
		if(a < b) swap(a, b);
		int g = gcd(a, b);
		int l = a * b / g;
		cout << g << " " << l << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int gcd(int m,int n){
  if((m==0)||(n==0)) return 0;
  while(m!=n){
    if(m>n) m=m-n;
    else n=n-m;
  }
  return m;
}
int lcm(int m,int n){
  if((m==0)||(n==0)) return 0;
  return ((m/gcd(m,n))*n);
}
int main(){
  int n,m;
  while(cin>>n>>m){
    cout<<gcd(n,m)<<" ";
    cout<<lcm(n,m)<<endl;
  }
return(0);
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    ll a,b;
    while(cin>>a){
        cin>>b;
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
   
    
    
    
return 0;
}

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

int gcd(int a, int b) {
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}

int main(void){
    int a, b, tmp;
    if (a < b){
        tmp = b;
b = a;
a = tmp;

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

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

int main()
{
	long a,b;
	while(cin>>a>>b)
	{
		long numerator=min(a,b);
		long denominator=max(a,b);
		long remainder = a % b;
		while(remainder !=0)
		{
			 numerator   = denominator;
			denominator = remainder;
			remainder   = numerator % denominator;
		}
		long gcd = denominator;
		long long lcm = a * (b / gcd);
		cout<<gcd<<" "<<lcm<<endl;
		/*
		for(long i=min(a,b);i>0;i--)
		{
			if(a%i ==0)
				if(b%i==0)
				{
					cout<<i<<" ";
					break;
				}
		}
		for(long i=max(a,b);i<=2000000000;i+=max(a,b))
		{
			if(i%a ==0)
				if(i%b==0)
				{
					cout<<i<<endl;
					break;
				}
		}*/
	}
}

C++: # include <iostream>

unsigned long long a, b;

unsigned long long gcd(unsigned long long x, unsigned long long y) {
	return (y == 0) ? x : gcd(y, x%y);
}

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

int main() {
	while (1) {
		if (std::cin.eof())
			break;
		std::cin >> a >> b;
		unsigned long long res1, ans;
		if (a < b)
			res1 = gcd(b, a);
		else
			res1 = gcd(a, b);
		ans = lcm(a, b, res1);
		std::cout << res1 <<' '<< ans << std::endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
long long int a, b;
long long int gcd()
{
	long long int min = a,other=b;
	if (b < a){
		min = b; other = a;
	}
	long long int i;
	for (i = 1; i <= sqrt(long double(min)); i++)
	{
		if (min%i == 0)
		{
			if (other % (min / i) == 0)
				return min / i;
		
		}
	}
	for (i = sqrt(long double(min)); i >= 1; i--)
	{
		if (min%i == 0)
		{
			if (other %  i == 0)
				return i;
	     }
		
	}
}
int main()
{
	while (scanf("%lld %lld",&a,&b)==2)
	{
		long long int g = gcd();
		printf("%lld ", g);
		printf("%lld\n", (a / g)*(b / g)*g);
	}
}

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

int main(){
  int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
   unsigned long int LCM = a;
   tmp = b;
    if( b > a )std::swap( a , b );
    while(a % b != 0){
      GCD = a % b;
      a = b;
      b = GCD;
    }
    LCM = ( LCM / GCD ) * tmp;
    std::cout << GCD << " " << LCM << std::endl;
  }
  return 0;
}