Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

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()
{
    int 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){
    int r=-1;
    int temp;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}

int main(){
    int a,b;
    int gcd;


    while(cin>>a>>b){
        gcd = Gcd(a,b);
        a=a/gcd;
        b=b/gcd;

        printf("%d %d\n",gcd,gcd*a*b);
    }

    return 0;
}

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

using namespace std;

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

// x, y, gcd
int lcm(int x, int y, int g) {
    return x/g*y;
}

int main(){
    int a, b, g, l;

    while (cin >> a >> b) {
        g = a > b ? gcd(a, b) : gcd(b, a);
        l = a > b ? lcm(a,b,g) : lcm(b,a,g);

        cout << g << " " << l << endl;
    }

    return 0;
}

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

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			swap(a, b);
		}

		for(; b != 0;){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

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

C++: #include <iostream>

using namespace std;

typedef long long llong;

int GCD(const llong& a, const llong& b) {
	llong g_a = a;
	llong g_b = b;
	if (a == 0 || b == 0)
		return 0;
	while (a != b)
	{
		if (a > b) 
			g_a -= g_b;
		else 
			g_b -= g_a;
	}
	return g_a;
}

int LCM(const llong& a, const llong& b) {
	llong l_a = a;
	llong l_b = b;
	if (a == 0 || b == 0)
		return 0;
	return ((l_a / GCD(l_a, l_b)) * l_b);
}

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

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

int main(void){
  int x,y,g,l,t;
  while(cin >> x >> y){
    if(x<y)
      swap(x,y);
    g=__gcd(x,y);
    l=x*y/g;
    cout << g << " " << l <<endl;
  }
  return 0;
}

C++: 
/* vo00_05.cpp */
#include <iostream>
using namespace std;

int euclid(long long a, long long b);

int main()
{
	int c;
	long long a, b, d;

	while (true) {
		cin >> a >> b;
		if (cin.eof()) break;

		c = euclid(a, b);
		d = a * b / c;

		cout << c << ' ' << d << '\n';
	}

	return 0;
}

int euclid(long long a, long long b)
{
	if (a < b) { int temp = a; a = b; b = temp; }

	int r;
	while (b != 0) {

		r = a % b;
		a = b;
		b = r;

	}


	return a;
}

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

int gcd(int x,int y){
  if(x%y==0) return y;
  else{
    int z=x%y;
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

C++: #include<stdio.h>
#include<math.h>

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

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

using namespace std;
//int solveGCD(int a, int b);

int a, b, tmp;

int solveGCD(int a, int b) {
  return b ? solveGCD(b, a%b) : a;
}

int main() {
  while(1) {
    scanf("%d %d", &a, &b);
    if(a<b) {tmp=a; a=b; b=tmp;}
    int gcd = solveGCD(a, b); 
    printf("%d %d\n", gcd, a/gcd*b);
  }
}

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

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


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

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

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((double)m/a);
        printf("%d %d\n",g,a);
    }
}

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

int gcd(int x,int y){
	int num;
	while(x % y != 0){
		num = x%y;
		x = y;
		y = num;
	}
	return y;
}


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

C++: #include <cstdio>
typedef long long int64;
int64 gcd(int64 a,int64 b)
{
	return b?gcd(a%b,b):a;
}
int main()
{
	int64 a, b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		int64 g=gcd(a,b);
		printf("%lld %lld\n",g,a/g*b);
	}
}

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

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

long long int LCM(long long int a, long long int b) {
    return (a / GCD(a, b)) * b;
}

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

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

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

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

int main()
{
	int a[2];
	int i=0;
	int n;
	while(cin >> n){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		if (i==sizeof(a) / sizeof(a[0]) - 1){
			a[i] = n;
			// cout << "start" << endl;
			// cout << "a[0]=" << a[0] << "a[1]=" << a[1] << endl;
			cout << gcm(a[0],a[1]) << ' ' << lcm(a[0],a[1]) << endl;
			i = 0;
		}
		else {
			a[i] = n;
			i++ ;
		}
	}
	
	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(){
	int a, b;
	int i;
	int k;

	while(cin >> a >> b){

		if(a > b){
			i = GCD(a, b);
		}
		else{
			i = GCD(b, a);
		}

		a = a / i;
		b = b / i;

		k = a * b * i;

		cout << i << " " << k << endl;
	}
}