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>

int main(){
    long long a,b,temp,cobai[50],coyaku[50],i=0,clm;

    while (std::cin){
        std::cin >> a >> b;
        clm = a*b;

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

        while (b!=0){
            temp = b;
            b = a%b;
            a = temp;
        }
        coyaku[i] = a;
        cobai[i]  = clm/a;
        i++;
    }
    for (int j=0;j<i-1;j++){
        std::cout << coyaku[j] << " " << cobai[j] << std::endl;
    }
}

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

int main(){
    unsigned int a,b,c;
    cin>>a>>b;
    int g,l,p;
    p=a*b;
    while(b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    g=a;
    l=p/g;
    cout<<g<<" "<<l<<endl;
}

C++: /*
 * main.cpp
 *
 *  Created on: 2011/04/09
 *      Author: satoki
 *      10:51 ~ 11:17
 *      ツδーツクツδ環ッツドツづ個古敖渉慊法
 */
#include <iostream>
#include <string.h>
using namespace std;

int iA;
int iB;

int iGCD;
int iLCM;

bool input() {
  if (scanf("%d %d", &iA, &iB) == EOF) return false;
  return true;
}

void manage() {
  int a, b, tmp;
  a = iA;
  b = iB;
  while (b) {
    tmp = a % b;
    a = b;
    b = tmp;
  }
  iGCD = a;
  a = iA;
  b = iB;
  iLCM = a / iGCD * b;
}

int main() {
  while (1) {
    if (!input()) break;
    manage();
    printf("%d %d\n", iGCD, iLCM);
  }
}

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

int main(){

	int a,b,GCD,LCM,c;

	while(cin>>a>>b){

		if(a>b){
			c=b;
		}
		else{
			c=a;
		}

		for(int i=1;i<=(c/2+1);i++){
			if(b%i==0 && a%i==0){
				GCD = i;
			}
		}
		if(b%a==0 || a%b==0){
			GCD = c;
		}
		LCM=a*b/GCD;
		cout<<GCD<<" "<<LCM<<endl;
	}

	return 0;
}

C++: #include<stdio.h>
long long Gcd(long long x,long long y);

int main(void){
	long long a,b,g,lcm;
	int i;
	while( scanf("%lld %lld",&a,&b) != EOF ){
		g=Gcd(a,b);
		lcm=a*b/g;
		
		printf("%lld %lld\n",g,lcm);
	}
	
	return 0;
}

long long Gcd(long long x,long long y){
	int i,j;
	long long tmp;
	if(y>=x){
		tmp=x;
		x=y;
		y=tmp;
	}
	
	for(i=0;;i++){
		x=x%y;
		
		tmp=x;
		x=y;
		y=tmp;
		
		if(y==0){
			break;
		}
	}

	return (x);
}

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

int main()
{
    int a, b, ba, bb;
    int gcd, lcd = 0;
    while(cin >> a >> b)
    {
        ba = a;
        bb = b;
        while(b!=0)
        {
            gcd = b;
            b = a % b;
            a = gcd;
        }
        lcd = ba * bb / gcd;
        cout << gcd << " "<< lcd << endl;
    }
    
    return EXIT_SUCCESS;
}

C++: #include<iostream>

int main(){
	int a,b;
	
	while( std::cin >> a >> b ){
		int num1 = a;
		int num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		int gcd;
		while( (gcd = num1%num2) != 0){
			num1 = num2;
			num2 = gcd;
		}
		gcd = num2;
		int lcm = a / gcd * b;
		std::cout << gcd <<" "<< lcm << "\n";
	}
	
	return 0;
}

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

typedef long long ll;

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

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

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

using namespace std; 

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

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  while(1){
    cin >> a >> b;
    if(cin.eof())
      break;
    int g=gcd(a,b);
    //printf("%d %d\n",g,a/g*b);
    cout << g << a/g*b << endl;
  }

  return 0;
}

C++: #include<stdio.h>
int main(void) {
	long long int a, b, minans = 0, maxans;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		for (long long int i = 2; i < b / 2; i++)
		{
			if (a%i == 0 && b%i == 0)maxans = i;
		}
		for (long long int i = 1; i <= a; i++)
		{
			if ((i*b) % a == 0 && (i*b) % b == 0) {
				minans = i*b;
				break;
			}
		}
		printf("%lld %lld\n", maxans, minans);
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
  int a, b;
	while(cin >> a >> b) {
	  cout << __gcd(a, b) << " " << (a*b)/__gcd(a, b) << endl;
	}
  return 0;
}

C++: #include<iostream>

using namespace std;

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

	//c
	h = a;
	s = b;
	for (;;){
		r = h % s;
		if (r == 0) {
			c = s;
			break;
		}
		h = s;
		s = r;
	}

	//d
	h = a;
	s = b;
	if (a < b){
		for (;;){
			if ((b % a)==0){
				d = b;
				break;
			}
			b = b + s;
		}
	}
	else if(a >= b){
		for (;;){
			if ((a % b) == 0){
				d = a;
				break;
			}
			a = a + h;
		}
	}

	cout << c << " "<< d;
	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>
using namespace std;
int main(){
int a,b,gcd,lcm,tmp,r;
while(cin>>num_a>>num_b){
a=num_a,b=num_b;
if(a<b){
tmp = a;
a = b;
b = tmp;
}
r=a%b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
gcd = b;
lcm = (num_a*num_b)/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		if(b==0)break;
	}
	if(a!=0)cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int gcd(int a,int b){
  if(a<b){
    int tmp=a;
    a=b;
    b=tmp;
  }
  while(b){
    int temp=a%b;
    a=b;
    b=temp;
  }
  return a;
}


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

C++: #include <iostream>

using namespace std;

int gcd( int m, int n ){
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

int lcm( int m, int n ){
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

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