Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <stdio.h>

int main( ){
    float a[20],b[20];
    int nCount = 0;
    while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){
        nCount++;
    }

    for( int k = 0;k < i;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    unsigned int a, b;
    while(cin >> a >> b){
        unsigned int _a = a, _b = b;
        unsigned int gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

C++: #include <algorithm>
#include <iostream>
using namespace std;
 
int main() {
    int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#define MAX 50000
using namespace std;

int p[MAX];

int main()
{
	//素数
	fill(p, p + MAX, 1);
	for (int i = 2; i < MAX; i++){
		int sqrti = (int)sqrt(i);
		for (int j = 2; j <= sqrti; j++){
			if (i % j == 0){
				p[i] = 0;
				break;
			}
		}
	}

	int a, b;
	while (cin >> a >> b){
		int gcm = 1;
		bool flag = true;
		while (flag){
			for (int i = 2;; i++){
				if (p[i] == 1 && a % i == 0 && b % i == 0){
					gcm = gcm * i;
					a = a / i;
					b = b / i;
					break;
				}
				if (i == min(a, b)){
					flag = false;
					break;
				}
			}
		}
		int lcm = gcm * a * b;
		cout << gcm << " " << lcm << endl;
	}
	return 0;
}

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

int main() {
	int a, b, gcd, lcm;
	while (cin >> a >> b) {
		for (gcd = a;a%gcd != 0 || b%gcd != 0;gcd--);
		lcm = (a / gcd)*b;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

typedef long long ll;

ll a, b;

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

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

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

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

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

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

typedef long long ll;

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

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

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

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

long long GCD (long long a, long long b)
{
    long long t;
    if (a>b) swap(a,b);
    while (1)
    {
        t=b%a;
        if (t==0) break;
        b=a;
        a=t;
    }
    return a;
}

int main()
{
    long long a,b,gcd[50],lcm[50],c=0;
    while (cin>>a>>b)
    {
        gcd[c]=GCD(a,b);
        lcm[c]=a*b/gcd[c];
        c++;
    }
    for (int i=0; i<c; i++) cout<<gcd[i]<<" "<<lcm[i]<<'\n';
    return 0;
}

C++: /*
练习题：GCD and LCM_AOJ 0005
	此题拓展了LCM(the least common multiple)的求法。 
*/ 

#include <cstdio>
#include <iostream>
using namespace std;

int a, b;

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

int main()
{
	while(scanf("%lld%lld", &a, &b)!=EOF)
	{
		long long g=gcd(a, b);
		printf("%lld ", g);
		printf("%lld\n", a/g*b);//注意这里先做除法！ 
		
	}
	
	return 0;
}

C++: /*
 0005-GCD_and_LCM.cpp
 
 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        long int temp_a = a;
        long int temp_b = b;
        while(1){
            long int l = max(temp_a,temp_b);
            long int r = min(temp_a,temp_b);
            
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                l = l-r;
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define vec vector
const int INF=0x3f3f3f3f;
#define N int(5e5+5)

ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	while(a%b){
		ll t=a%b;
		a=b;
		b=t;
	}
	return b;
}
int main(){
	ios::sync_with_stdio(false);
	ll a,b;
	while(cin>>a>>b){
		ll g=gcd(a,b);
		ll lcm=g*(a/g)*(b/g);
		cout<<g<<' '<<lcm<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }


int main() {
    ll a, b;
    while(cin >> a >> b) {
        cout << GCD(a, b) << " " << LCM(a, b) << endl;
    }
}

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

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

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

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

int main(void){
    long long a,b,c,d,x,ans01,ans02;
    int count;
    while(std::cin >> a >> b && count <= 50){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
        count ++;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
#define REP0(i,n) for(int i=0;i<n;++i)
#define REP1(i,n) for(int i=1;i<=n;++i)
#define ALL(c) (c).begin(),(c).end()
typedef long long ll;
ll gcd(ll a,ll b){
	while(b>0){
		if(a>b) swap(a,b);
		b%=a;
	}
	return a;
}
int main(){
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF) printf("%lld %lld\n",gcd(a,b),a/gcd(a,b)*b);
	return 0;
}

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

using namespace std;

long int  a, b;
long int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}