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 <cstdio>
int gcd(int a,int b)
{
    return b? gcd(b,a%b):a;
}
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b) != EOF)
    {
        int g = gcd(a,b);
        int l = a/g*b;
        printf("%d %d\n",g,l);
    }
}

C++: #include<iostream>
#include<stdio.h>
int yue(int a,int b){
	int min;
	int max;
	if(a==0||b==0){
		return 0;
	}else{
		if(a<b){
			min=a;max=b;
		}else{
			min=b;max=a;
		}
		int shang=max-min;
		while(shang!=min){
			if(shang<min){
				max=min;
				min=shang;
			}else{
				max=shang;
				min=min;
			}
			shang=max-min;
		}
		return shang;
	}
}
int bei(int a,int b){
	int min;
	int max;
	if(a==0||b==0){
		return 0;
	}else{
		if(a<b){
			min=a;max=b;
		}else{
			min=b;max=a;
		}
		int yu=max%min;
		int beishu=1;
		int mmax=max;
		while(yu!=0){
			beishu++;
			max=mmax*beishu;
			yu=max%min;
		}
		return max;
	}
}
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF){
		printf("%d %d\n",yue(a,b),bei(a,b));
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(j=0;j<50;j++){
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    }
    }
    return 0;
}

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

int main(void);
int gcd(int x, int y);
int lcm(int x, int y);

int main(){
	int dataset_count = 0;
	int first_num = 0;
	int second_num = 0;

	std::vector<int> first_num_vector;
	std::vector<int> second_num_vector;

	while ((std::cin >> first_num >> second_num) || (dataset_count < 50)){
		dataset_count++;
		first_num_vector.push_back(first_num);
		second_num_vector.push_back(second_num);
	}
	for (int i = 0; i < first_num_vector.size(); i++){
		std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl;
	}
	return 0;
}


// 最大公約数を求める関数
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

//	最小公倍数を求める関数
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	return (x * y / gcd(x, y));
}

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

int main(){
    int a,b,a1,b1,r;
    int tmp=0;
    int i=0;
    
    while(scanf("%d %d",&a,&b)){
        if(a<b){
            tmp=a;
            a=b;
            b=tmp;
        }
        
        a1=a;
        b1=b;
        r=a1%b1;
        while(r!=0){
            a1=b1;
            b1=r;
            r=a1%b1;
            
        }
        printf("%d %ld\n",b1,(long)a*b/b1);
    }
    
    
    return 0;
    
}

C++: #include<iostream>
using namespace std;
int main()
{
  int a,b;
  while(cin.peek!=EOF)
  {
    cin>>a>>b;
    int w=a,f=b;
    int temp=a%b;
    while(temp!=0)
    {
      a=b;
      b=temp;
      temp=a%b;
    }
    cout<<b<<" "<<w/b*f<<endl;
  }
  return 0;
}

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

int saidai(long long int a,long long int b){
	while(b){
		int m=a%b;
		a=b;
		b=m;
	}
	
	return a;
}


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

int main(){
	long long int a,b;
	cin>>a;
	cin>>b;
	
	cout<<saidai(a,b)<<" "<<saisyou(a,b);;
	return 0;

}

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

C++: using System;
using System.Linq;
public class Test {
	public static int gcd(int x, int y) {
		if(y == 0) return x;
		return gcd(y, x % y);
	}
	public static int lcm(int x, int y) {
		return x / gcd(x, y) * y;
	}
	public static void Main() {
		string buf;
		while(!string.IsNullOrEmpty(buf = Console.ReadLine())) {
			string[] sc = buf.Split();
			int a = int.Parse(sc[0]), b = int.Parse(sc[1]);
			Console.WriteLine(gcd(a, b) + " " + lcm(a, b));
		}
	}
}

C++: /* All men have limits. They learn what they are and learn
   not to exceed them, I ignore mine. -Batman           */
#include <bits/stdc++.h>
//#include <iostream>
//#include <Windows.h>
using namespace std;
long long int gcd(long long int a,long long int b){
while(1){
	if(a==0)return b;
	b%=a;
	if(b==0)return a;
	a%=b;
}
}

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

return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n];
	for(int i=0;i<n;i++) p[i] = 0;
	for(int i=2;i<n;i++){
		if(p[i]==0) for(int j=2;j<n/i;j++) p[i*j] = 1;
	}
	int q[n];
	int c = -1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			c++;
			q[c] = i;
		}
	}
	long a,b;
	while(cin >> a >> b){
		int t[c],s[c];
		for(int i=0;i<c;i++) t[i] = 0;
		for(int i=0;i<c;i++) s[i] = 0;
		int as = a;
		while(1){
			int temp = as;
			for(int i=0;i<c;i++){
				if(as%q[i]==0){
					s[i]++;
					as = as/q[i];
				}
			}
			if(temp==as) break;
		}
		int at = b;
		while(1){
			int temp = at;
			for(int i=0;i<c;i++){
				if(at%q[i]==0){
					t[i]++;
					at = at/q[i];
				}
			}
			if(temp==at) break;
		}
		long z = 1;
		if(at==as) z = at;
		long y = z;
		for(int i=0;i<c;i++){
			y *= pow(q[i],max(s[i],t[i]));
			z *= pow(q[i],min(s[i],t[i]));
		}
		cout << z << " " << y << endl;
	}
}

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

C++: #include<cstdio>
long int a,b,G,L,i,j;
long int gcd(long int a,long int b)
{    return(0==b?a:gcd(b,a%b));}
int main()
{
    while(scanf("%ld%ld",&a,&b)!=EOF)
    {
        G=gcd(a,b);
        i=a/G;
        L=b*i;
        printf("%ld %ld\n",G,L);
    }
    return 0;

}

C++: #include <iostream>
#include<cstdio>
using namespace std;
long long gcd(int a,int b)
{
    return b==0? a:gcd(b,a%b);
}

long long lcm(int a,int b)
{
    return a/gcd(a,b)*b;
}
int main()
{
    //freopen("in.txt","r",stdin);
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }


    return 0;
}

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

u_int euclid_alg(const u_int a, const u_int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	u_int a,b;
	std::vector<u_int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		u_int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}