Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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++){}
	}
}