Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	long long a,b;
	
	while(cin>>a>>b){
		int r = a%b;
		long long lcm = a*b;
		while(r != 0){
			a = b;
			b = (long)r;
			r = a%b;
					
		}
		lcm /= b;
		cout<<b<<" "<<lcm<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1234567;
const ll INF=1000000010;
const ll LINF=1000000000000000010LL;
const int MAX=500010;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
//最大公約数
ll gcd(ll m,ll n){
    if((0==m)||(0==n)){
        return 0;
    }
    if(m<n){
        swap(m,n);
    }
    ll r=m%n;
    while(r!=0){
        m=n;
        n=r;
        r=m%n;
    }
    return n;
}
//最小公倍数
ll lcm(ll m,ll n){
    if((0==m)||(0==n)){
        return 0;
    }
    return ((m/gcd(m,n))*n);
}
int main(){
	ll a,b;
	while(cin>>a>>b){
		cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>

using namespace std;

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

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

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

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

	int main(){

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

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

int main(){
const int INF=100;
int a[2];
int GCD,LCM;
while(cin>>a[0]>>a[1]){
for(int i=0;i++;i<INF){
a[0]%=a[1];
if(a[0]==0){
GCD=a[1];
break;}
a[1]%=a[0];
if(a[1]==0){
GCD=a[0];
break;}}
LCM=a[0]*a[1]/GCD;
cout<<GCD<<" "<<LCM<<endl;}}

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

int main() {
	long long x;
	long long y;
	long long g;
	while (1) {
		cin >> x;
		cin >> y;
		g=x*y;
		while (x*y!=0) {
			if (x>y) {
				x=x%y;
			}
			else {
				y=y%x;
			}
		}
		if (x==0) {
			x=y;
		}
		cout << g/x << " " << x << "\n";
	}
	return 0;
}

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

using namespace std;

long long int find_GCD(long long int a, long long int b){
  long long int max = 0;
  for(int i=min(a, b);i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

long long int find_LCM(long long int a, long long int b){
  long long int LCM;
  for(int i=max(a, b);i<=a*b;i+=max(a, b)){
    if(i%a==0 && i%b==0){
      break;
    }
  }
}

int main(){
  long long int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
    //    long long int GCD = find_GCD(a, b);
    //    long long int LCM = a*b/GCD;

    long long int GCD;
    long long int LCM;
    LCM = find_LCM(a, b);
    GCD = a*b/LCM;
    cout << GCD << " " << LCM << endl;
  }

}

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

ll gcd(ll p, ll q){
    if(q==0) return p;
    else return gcd(q, p%q);
}

ll lcm(ll p, ll q){
    ll g = gcd(p, q);
    return p/g*q;
}

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

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

int main(){
	long a, b, dmy, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;

		lcm=t/gcd;
		printf("%d %d\n",gcd, lcm);
	}
	exit(0);
}

C++: #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>

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

C++: #include<iostream>
using namespace std;
int gl(int a,int b, int x, int y);
int main(){
	int a,b;
	while(cin >>a>>b){
		gl(a,b,a,b);
	}
	return 0;
}
int gl(int a, int b, int x, int y){
	if(b == 0){
		cout <<a<<" "<<x/a*y<<endl;
		return 0;
	}
	return gl(b,a%b,x,y);
}

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

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<iostream>
using namespace std;
int gcd(int a, int b){
	int t;
	if(a < b){t=a;a=b;b=t;}
	t = b;
	b = a % b;
	a = t;
	if(b == 0){
		return a;
	}else{
		gcd(a,b);
	}
}
int lcm(double a, double b){
	return (a * b) / (gcd(a,b));
}
int main(){
	int a,b;
	while(cin >> a >> b)
	cout << gcd(a,b) << ' ' << lcm(a,b) << '\n';
	return 0;
}

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

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

int main()
{
	while(true){
		int a, b;
		cin >> a >> b;
		if(cin.eof()) break;
		int GCD;
		GetGCD(a, b, GCD);
		int LCM = a * (b / GCD);
		cout << GCD << ' ' << LCM << endl;
	}
	return 0;
}

C++: #include <cstdio>

//input
int a, b;

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

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

void solve(){
	printf("%d %d\n", gcd(a, b), lcm(a, b));
}

int main(int argc, char const *argv[]){

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

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void)
{
    int a,b,fl;
    while(cin>>a>>b)
    {
        fl=0;
        for(int i=1;fl==0;i++)
        {
            if(a%i==0&&b%(a/i)==0)
            {
                cout<<a/i<<" ";
                fl++;
            }
            else;
        }
        fl=0;
        for(int i=1;fl==0;i++)
        {
            if((a*i)%b==0)
            {
                cout<<a*i<<endl;
                fl++;
            }
            else;
        }
    }
    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 = a;
        a = b;
        b = tmp;
        }
     
     while(cin >> a >> b){
         int lcm = (a*b)/gcd(a,b);
         cout<<gcd(a,b)<<" "<<lcm<<endl;
     }
     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(1){
	int a,b;
	cin>>a>>b;

	if(cin.eof()) break;
	if(a==0||b==0)break;
	
	int g=gcd(a,b);
	cout<<g<<' '<<a/g*b<<endl;
 }
 return 0;
}