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 <cstdio>

using namespace std;
 
int saidai(int a, int b);
int saisho(int a, int b);

int main(){
	int a, b;

	while(cin >> a >> b){
		if(a<b) swap(a,b);
		
		cout << saidai(a, b) << " " << saisho(a,b) << endl;
	}
}

int saidai(int a, int b){
	
	int x=1;
	for(int i=2; i<=a; i++){
		while(1){
		if(a%i == 0 && b%i == 0){
			 x = x * i;
			 a =a/i;
			 b =b/i;
		}
		 else break;
		}
	}

	return x;
}

int saisho(int a, int b){

	int y=1;
	for(int i=2; i<=a; i++){
		while(1){
		if(a%i == 0 && b%i == 0){
			 y = y * i;
			 a =a/i;
			 b =b/i;
		}
		 else break;
		}
	}

	y = y * a * b;

	return y;
}

C++: #include <iostream>

int GCD(int a, int b) {
	int
		c = std::max(a, b),
		d = std::min(a, b);
	while (c != d) {
		c -= d;

		int tmp[] = {c, d};
		c = std::max(tmp[0], tmp[1]);
		d = std::min(tmp[0], tmp[1]);
	}

	return c;
}

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

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

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}

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

C++: #include <iostream>

using namespace std;

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


int main() {
    int a, b;
    while(true) {
        cin >> a;
        if(cin.eof()) break;
        cin >> b;
        int g=gcd(a, b);
        cout << g << " " << (a/g)*b << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    int a,b;

    while(scanf("%d%d",&a,&b)!=EOF){
        int gcd;

        for(int i=2;i<=((a<b)? b:a);i++){
            if((a%i==0)&&(b%i==0)) gcd=i;
        }

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

    return 0;
}

C++: #include<iostream>
#include<utility>
using namespace std;
int main()
{
  long long int n=0,m=0;
  long long int i=0,j=0,l=0;

  while(scanf("%d %d",&n,&m) != EOF)
    {
      i = n;
      j = m;

      //koyaku
      if((n >= m) != true)swap(n,m);
      while(1)
	{
	  int amari = n % m;
	  n = m;
	  m = amari;
	  if(amari == 0) break;
	}
      
      //kobai
      l = i*j/n;
      
      cout << n << " " << l << endl;
    }
}

C++: #include <stdio.h>

int gcd(int,int);

int main(void){
	long a,b;
	long divi,multi;
	while(scanf("%ld %ld",&a,&b) != EOF){
		divi = gcd(a,b);
		multi = a*(b / divi);
		printf("%ld %ld\n",divi,multi);
	}
	return 0;
}

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

C++: #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <cstring>
#include <cstdlib>

//typedef struct
//{
//    int left_val;
//    int right_val;
//};

class GcdAndLcm
{
public:
    GcdAndLcm() : m_gcd(0), m_lcm(0) {}
    void Run();

private:
    void readData();
    void GetData(std::string s, int& v1, int& v2);
    int calcGcd(int m, int n);
    int calcLcm(int m, int n);
    void Show();

private:
    std::vector<std::string> m_data;
    unsigned int m_gcd;
    unsigned int m_lcm;
};

void GcdAndLcm::Run()
{
    int val1 = 0, val2 = 0;

    readData();
    
    for (unsigned int i = 0; i < m_data.size(); ++i) {
        GetData(m_data[i], val1, val2);
        m_gcd = calcGcd(val1, val2);
        m_lcm = calcLcm(val1, val2);
        Show();
    }
}
void GcdAndLcm::readData()
{
    std::string line;

    while (std::getline(std::cin, line)) {
        m_data.push_back(line);
    }
}

void GcdAndLcm::GetData(std::string s, int& v1, int& v2)
{
    size_t pos = s.find(" ");
    char tmp[100] = { 0 };
    std::strncpy(tmp, s.c_str(), pos);
    v1 = std::atoi(tmp);
    std::memset(tmp, 0x00, sizeof(tmp));
    pos++;
    std::strncpy(tmp, s.c_str() + pos, s.size() - pos);
    v2 = std::atoi(tmp);
}
int GcdAndLcm::calcGcd(int m, int n)
{
    if ((0 == m) || (0 == n))
        return 0;

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

int GcdAndLcm::calcLcm(int m, int n)
{
    if ((0 == m) || (0 == n))
        return 0;

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

void GcdAndLcm::Show()
{
    std::cout << m_gcd << " " << m_lcm << std::endl;
}

int main()
{
    GcdAndLcm gcdAndLcm;

    gcdAndLcm.Run();
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	int a[2];
	int tmp;
	int GCD = 1;
	int LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		for (size_t i = 1; i < a[0]; i++)
		{
			if (a[0] % i == 0 && a[1] % i == 0)
			{
				GCD = i;
			}
		}

		// ????°???¬?????°????¨????
		for (size_t i = a[0];; i++)
		{
			if (i % a[0] == 0 && i % a[1] == 0) {
				LCM = i;
				break;
			}
		}
		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int lcm(long long x,long long y);
int gcd(long long x,long long y);
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<lcm(a,b)<<" "<<gcd(a,b)<<endl;
    }

    return 0;
}
int lcm(long long x,long long y)
{
    long long s,b,r;
    if(x>y)
    {
        b=x;
        s=y;
    }
    else
    {
        b=y;
        s=x;
    }
    r=b%s;
    while(r!=0)
    {
        b=s;
        s=r;
        r=b%s;
    }
    return s;


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

}

C++: 
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
using namespace std;
typedef long long int ll;

ll gcd(ll n, ll m){
    if(n%m>0){
        return gcd(m,n%m);
    }else{
        return m;
    }
}

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