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 <algorithm>
#include <climits>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <stack>
#include <string>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;

/*------------------------------------------------------------------------------*/

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

int main(){
  int a, b;

  while(cin >> a >> b){

    int g = gcd(a, b);

    int lcm = a * (b / g);

    cout << g << " " << lcm << endl;
  }

  return 0;
}

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

int main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	
	int n[50]={0};
	int i=0;
	while(cin>>n[i++]);
	int nn=i-1;
	int gcd=0,lcm=0,a=0,b=0;
	for(int j=0;j<nn;j+=2){
		for(int k=1;k<n[j];k++){
			if(n[j]%k+n[j+1]%k==0)gcd=k;
		}
		a=n[j]/gcd,b=n[j+1]/gcd;
		cout<<gcd<<" "<<gcd*a*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int a,b,r,A,B,tmp;
  while(cin>>a>>b){
    A = a; B = b;
    if(b>a){
      tmp=a;a=b;b=tmp;
    }
    while(1){
      r = a % b;if(r == 0) break;
      a = b;
      b = r;
    }
    cout << b <<" "<< A/b*B << endl;
  }
}

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

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

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

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i >= 1; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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

C++: #include <iostream>
using namespace std;
int LCM(int a, int b);
long GCD(int a, int b, int ans1);

int main(){
    int a,b;
    while(cin >> a >> b){
        int ans1 = LCM(a,b);
        long ans2 = GCD(a,b,ans1);
        cout << ans1 << " " << ans2 << endl;
    }
}

int LCM(int a, int b){
    while(1){
        if(a % b == 0) break;
        b = a % b;
        a = b;
    }
    
    return b;
}

long GCD(int a, int b, int ans1){
    double ans = a * b / ans1;
    return (long)ans;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b) {
		for (int i = min(a,b); i > 0; i--)
		{
			if (a%i == 0 && b%i == 0)
			{
				cout << i << " ";
				goto Cs;
			}
		}
		Cs:
		for (int i = max(a,b); ; i++)
		{
			if (i%a == 0 && i%b == 0)
			{
				cout << i << endl;
				goto Cpp;
			}
		}
	Cpp:
		for (int i = 0; i < 0; i++){}
	}
}