Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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

using namespace std;

int main() {

long long int a, b, r, haco1, haco2, maxky, minkb;

while (1) {

	cin >> a >> b;
	haco1 = a;
	haco2 = b;
	
	if ( cin.eof() ){
		break;
	}	

	//loop of maxky
		while(1){
				if(b == 0) {
					maxky = a;
					break;
				}
			r = a % b;
				if(r == 0){
					maxky = b;
					break;
				}
			a = b % r;
				if(a == 0){
					maxky = r;
					break;
				}			
			b = r % a;
		}
		
		//minkb
		
		minkb = (haco1 * haco2) / maxky;

	cout << maxky << " " << minkb << endl; 		
}


    return 0;
}

C++: #include <iostream>

using namespace std;
long long int firstNumber,secondNumber;

long long int GCD(int x, int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        if(y<x)
        {
            x = x-y;
        }
    }
    return x;
}

long long int LCM(int x, int y)
{
    return (x / GCD(x,y))*y;
}



int main()
{   while(cin >> firstNumber >> secondNumber)
    {
        cout << GCD(firstNumber,secondNumber) << " " << LCM(firstNumber,secondNumber) << endl;
    }

}

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;

}