Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

const int MAX_N=50100;
int p[(MAX_N+1)/2];
bool isp[MAX_N+1];

int gen_ps(){
    memset(isp,1,sizeof(isp));
    isp[0]=isp[1]=false;
    int idx=0;
    loop(i,2,MAX_N+1){
        if(!isp[i]) continue;
        p[idx++]=i;
        for(int j=i+i; j<=MAX_N; j+=i){
            isp[j]=false;
        }
    }
    return idx;
}

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

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<10;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	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 gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a%b);
}

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++: #include<stdio.h>
long long int a, b;
long long int gcd()
{
	long long int min = a;
	if (b < a)min = b;
	int i;
	long long int max = 1;
	for (i = 2; i <= min; i++)
	{
		if (a%i == 0 && b%i == 0 && i > max)
			max = i;
	}
	return max;
}
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<cmath>

using namespace std;

int main()
{
	unsigned int  a,b;

	while(cin >> a >> b){
		if(a<=0 || b<=0)
			continue;

		int temp = a<b?a:b;

		int t = temp;
		while((a<b?b:a)%t || (a<b?a:b)%t){
			if(!t)
				break;
			--t;
		}
		cout <<t<<" "<<flush;

		t = a>b?a:b;
		while(true){
			if(!(t%a))
				if(!(t%b))
					break;
			++t;
		}
		cout <<t<<endl;
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;

int GCD(int, int);
int LCM(int, int);

int main ()
{
    int a, b;
    while(cin >> a >> b){
        cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
    }
    return 0;
}

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

int LCM(int a, int b){
    int64 ab = (int64)a*b;
    return ab / GCD(a, b);
}

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

int gcd( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	while( m != n ){
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}
int lcm( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	return ((m / gcd(m, n)) * n); 
}
int main(){
	int m, n;
	cin >> m;
	cin >> n;
	cout << gcd(m,n) << " " << lcm(m,n) << endl;
	return 1;
}

C++: /*************************************************************************
    > File Name: aoj0005.cpp
    > Author:    WArobot 
    > Blog:      http://www.cnblogs.com/WArobot/ 
    > Created Time: 2017??´06???19??\ ????????? 16??¶44???39?§?
 ************************************************************************/

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

#define ll long long
ll gcd(ll a,ll b){
	return b == 0 ? a : gcd(b,a%b);
}
int main(){
	ll a , b;
	while(~scanf("%lld%lld",&a,&b)){
		ll ret = gcd(a,b);
		printf("%lld %lld\n",ret,a*b/ret);
	}
	return 0;
}

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

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

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

int main() {
    int a,b;
    while (cin>>a>>b) {
        if (a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        int gcd = get_gcd(a,b);

        int lcm = a / gcd * b;
        cout << gcd << " " << lcm << endl;

    }
    return 0;
}

C++: #include<cstdio>
int a,b;int g(int a,int b){return b?g(b,a%b):a;}main(){while(~scanf("%d%d",&a,&b))printf("%d %d\n",g(a,b),a/g(a,b)*b);}

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

using namespace std;

int main() {
    int a,b,a2,b2;
    int lcm,gcd;
    while(cin >> a >> b){
        a2=a;
        b2=b;
        while(a != b){
        if(a>b){a = a-b;}
        else{b=b-a;}
        }
        lcm = a;
        gcd=a2 / lcm * b2;
        cout << lcm << " " << gcd << endl;
    }

}