Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include<iostream>


#define ll long long

using namespace std;

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

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


void solver() {
    ll a, b;
    while (cin >> a >> b) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
}

int main() {
    solver();
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
    unsigned int a, b;
    while (cin >> a >> b)
    {
        int r = 1;
        unsigned int g = 1, l = 1;
        if (a < b)
        {
            unsigned int _a = a, _b = b;
            while (_b % _a != 0)
            {
                r = _b % _a;
                _b = _a;
                _a = r;
            }
            g = _a;
            a = a / g;
            b = b / g;
            l = g * a * b;
        }
        else if (b < a)
        {
            unsigned int _a = a, _b = b;
            while (_a % _b != 0)
            {
                r = _a % _b;
                _a = _b;
                _b = r;
            }
            g = _b;
            a = a / g;
            b = b / g;
            l = g * a * b;
        }
        cout << g << ' ' << l << endl;
    }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while(1)
    {
        cin>>n>>m;
        t=d(n,m);
        cout<<t<<" "<<n*(m/t)<<endl;
    }
    return 0;
}

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

int saidai(int a,int b){
	while(a !=b){
		if(a>b){
			a -=b;
		}
		else{
			b -=a;
		}
	}
	return a;
}

int saisyou(int a,int b){
	return a*b/saidai(a,b);
}


int main(){
	int a,b,c,d;
	cin>>a;
	cin>>b;

	c=saidai(a,b);
	d=saisyou(a,b);
	cout<<c<<" "<<d;
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n,a,s,i,d,c,j,x,g,w,z,m;
	while(scanf("%d %d",&a,&s)!=EOF){
		w=a; z=s;
		if(a==0&&s==0) break;
		if(a<s){
			n=a;
			a=s;
			s=n;
		}
		while(s!=0){
			a=a%s;
			g=a;
			a=s;
			s=g;
		}
		m=(w/a)*(z/a)*a;
		printf("%d %d\n",a,m);	
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd, lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 1;;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		printf("%d %d\n",gcd, lcm);
	}
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <cstdlib>
using namespace std;

// 一行取って、一番初めのTを習得
template <class T> int streamvar(std::istream& in, T& var)
{
    string s;
    if (!in) {
        return 1;
    }
    getline(in, s);
    istringstream is(s);
    is >> var;
    if (is.fail()) 
        return 1;
    return 0;
}
// 一行取って、T vectorに格納する
template <class T> int streamvec(std::istream& in, std::vector<T> &v)
{
    v.clear();
    string s;

    if (!in) 
        return 1;
    getline(in, s);
    if (in.fail()) 
        return 1;
    istringstream is(s);
    while (1) {
        T tmp;
        is >> tmp;
        if (is.fail())
            break;
        v.push_back(tmp);
    }
    return 0;
}

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

int main(void)
{
    vector<int> v;
    while (!streamvec(cin, v)) {
        cout << gcd(v[0], v[1]) << " " << (long long)v[0] / gcd(v[0], v[1]) * v[1] << endl;
    }
    return 0;
}

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

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

int main()
{
    int a, b;

    cin >> a;
    cin >> b;
  
 

    cout << gcd(a, b) << " " << lcm(a, b) << endl;
    return (0);
}

C++: 
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <functional>
#include <string.h>
#include <cmath>

using namespace std;

int gcd(int a, int b)
{
    while(b){
        a %= b;
        a ^= b ^= a ^= b;
    }
    return a;
}

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

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

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

		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			if (b == 0){
				printf("0 ");
				break;
			}

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		if (b == 0){
			printf("%d\n", a);
		}

		m = a / b;/*/公倍数*/
		m *= B;
		printf("%d\n",m); 
	}

	return 0;
}

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

long long gcd (long long a, long long b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%ld", &a) != EOF) {
    scanf("%ld", &b);
    long long g = gcd(a, b);
    printf("%ld %.3lf\n", g, a * b / g);

  }

  return 0;
}

C++: #include <stdio.h>

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

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


  return 0;
}

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

using namespace std;

typedef long long ll;

double xx(double r) {
  return r*r;
}

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

int main() {
  ll a, b;
  while ( scanf("%lld%lld", &a, &b) != EOF ) {
    ll g = gcd(a, b);
    ll l = a / g * b;
    cout << g << " " << l << endl;
  }
}

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;
     
     while(cin >> a >> b){
         int lcm = (a*b)/gcd(a,b);
         cout<<gcd(a,b)<<" "<<lcm<<endl;
     }
     return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
//辗转相除 
int gcd(int a, int b) {
	if(b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

int main()
{
	int a, b;
	while(cin >> a >> b) {
		
		int a1 = max(a, b);
		int b1 = min(a, b);
		int res1 = gcd(a, b);					//最大公约数 
		long long t = (long long)a * b;		//t可能会超int范围(没有尝试) 
		long long res2 = t / res1;			//最小公倍数 
		cout << res1 << " " << res2 << endl;
		
	}
	return 0;
}

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

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;
}

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

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

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 / gcd(num1, num2) * num2;
}

int main() {
	long a, b;
	while (~scanf("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),lcm(a,b));
	}
}