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 <iostream>
#include <vector>
using namespace std;
int main() {
 int a,b,c,x,y;
 vector<int> lcm,gcm;
 while(cin >> a >> b) {
 if (a<b) swap(a,b); 
 x=a; y=b;
 while( a % b!=0) { c=b; b=a % b; a=c; }
 lcm.push_back(b); y=y/b; gcm.push_back(y*x);
 }
 for (c=0;c<lcm.size();c++) cout << lcm[c] << " " << gcm[c] << endl; 
 return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;

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

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

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)1e5 + 5;

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

template<typename T>
T lcm(T m, T n)
{
	return ((m / gcd(m, n)) * n);
}

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

C++: #include <stdio.h>

int main(){
long int a,b,aa,bb;
long int x,y,q;

while(scanf("%d %d",&a,&b) != EOF){
aa=a;
bb=b;
while(a%b!=0){
x=a%b;
a=b;
b=x;
}
q=(aa*bb)/b;

printf("%d %d\n",b,q);
}
return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int gcd(int x,int y){
	int work=0,first=1,answer=0;
	if(x<=y){
		work=x;
		x=y;
		y=work;
	}
	while(1){
		first=x%y;
		if(first==0){
			answer=y;
			return answer;
		}
		x=y;
		y=first;
	}
}
int main(void)
{
	int a=0,b=0;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0){
			break;
		}
		else{
			cout<<gcd(a,b)<<" "<<(a*b)/gcd(a,b)<<endl;
		}
	}
	return 0;
}

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

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

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

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

long gcm(long a, long b){
	if (a<b) swap(a, b);

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

int main(void){

	while (true){
		long a, b, x, y;
		cin>>a>>b;
		if (cin.eof()) break;

		x = gcm(a, b);
		y = a / x * b;
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

C++: //0005 GCD and LCM
//üÍ³ê½2ÌÅåöñÆÅ¬ö{ðoÍ¹æ
//½¾µAÅåö{Í20­ð´¦È¢

#include<iostream>
using namespace std;

template<class T>
inline T GCD(T a, T b)
{
	T c;
	while( (c = a%b) != 0)
	{
		a = b;
		b = c;
	}
	return b;
}

template<class T>
inline T LCM(T a, T b)
{
	return (a / GCD(a, b) * b);
}

int main(void)
{
	int a, b;
	while( cin >> a >> b)
	{
		cout << GCD(a, b) << ' ' << LCM(a, b) << 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>
using namespace std;
int main(){
    int a,b,x;
    long long c;
    cin >> a >> b;
    c=a*b;
    if(a>=b){
        x=a;
        a=b;
        b=x%b;
    }
    else if(a<b){
        b=a%b;
    }
    while(a!=0 || b!=0){
        x=a;
        a=b;
        b=x%b;
    }
    cout << a << " " << c/a << endl;
}

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 = min(temp_a, temp_b);
		cout << gcd << " ";

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

	}

	//getchar();

	return 0;
}

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

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

int solve(int a, int b) {
	int r;
	r = a % b;
	if (r == 0) return b;
	else return solve(b, r);
}

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

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

	return 0;
}

C++: #include<cstdio>
int gcd(int a, int b){
  if(a == 0){
    return b;
  }else if(a > b){
    return gcd(a%b, b);
  }else if(a < b){
    return gcd(b%a, a);
  }
}
int main(){
  int a, b;
  while(scanf("%d%d", a, b)){
    int c=gcd(a,b);
    printf("%d %d\n", c, a*b/c);
  }
}

C++: #include  <stdio.h>
int main (void)
{
int i,j,a,b,c,e,f,bai[4] = {0},yaku[4] = {0};
	
	for(i = 0;i < 2;i++){
		scanf("%d %d",&a,&b);
		if(a > b){
			c = b; e = a;
		}	
		else{
			c = a; e = b;
		}
		
		if(e % c == 0){
			yaku[i] = c;
			bai[i] = e;
		}
		else{
			for(j = 1;j < c;j++){
				if(c % j == 0){
					f = c / j;
					if(e % f == 0){
						yaku[i] = f;
						j = e;
					}	
				}
			}
			if(yaku[i] == 0){
				yaku[i] = 1;
			}
			for(j = c;j > 0;j--){
				if(j * e <= 2000000000){
					if(j * e % c == 0){
						bai[i] = j * e;
					}	
				}
			}
		}
		
	}
	
	printf("%d %d\n%d %d",yaku[0],bai[0],yaku[1],bai[1]);
	
	return(0);
}

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

int GCD( int x , int y )
{
	if( x < y ){ swap( x,y ); }

	if( x % y == 0 ){ return y ; }
	else{ GCD( y , x%=y ) ; }
}

int main()
{
	unsigned int a,b ;

	while( cin >> a >> b )
	{
		cout << GCD(a,b) << " " << a/GCD(a,b) * b << endl ;
	}

	return 0 ;
}

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

int main()
{
	long long a,b,m,n,d,e,f,i,c,k;
	while(cin>>a>>b)
	{
		if(a<b)
		{
			d=a;
			a=b;
			b=d;
		}
		e=a;
		f=b;
		c=a%b;
		 while (c!=0)   
         {
		 	a=b;
		 	b=c;
		 	c=a%b;
		  }
		n=b;
		k=(e*f)/n;
		m=k;
		cout<<n<<" "<<m;
		cout<<endl;
	}
	return 0;
 }