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 <stdio.h>
#include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <algorithm>

typedef long long int lli;
#define PI 3.1415926535897932
#define MAX(a,b) ((a>b)?(a):(b)) // ?????§????????????
#define MIN(a,b) ((a<b)?(a):(b)) // ????°?????????????
#define INRANGE(a,b,c) ((a<=b&&b<=c)?(1):(0)) // a<=b<=c??????????????????????????????

int zeller(int y,int m,int d){ // ?????§??????
	if(m<3){y--; m+=12;}
	return (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
}

lli gcd(lli a,lli b){	// ?????§??¬?´???°
	if(b==0) return a;
	return gcd(b,a%b);
}

lli lcm(lli a,lli b){	// ????°???¬?????°
	return a*b/gcd(a,b);
}

int main(void){
	lli a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

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

int func1(int a,int b){
    while(a != b){
        if(a>b)a-=b;
        else b-=a;
    }
    return a;
}

int func2(const int a,const int b){
    int a2=a,b2=b;
    while(a2 != b2){
        if(a2>b2)b2+=b;
        else a2+=a;
    }
    return a2;
}

int main(){
    int a,b;
    while(cin >> a >> b){
        cout << func1(a,b) << " " << func2(a,b);
    }
    return 0;
}

C++: #include <stdio.h>
typedef long long lint;
int a,b;
int gcd(int a,int b) {
    if(b==0) return a;
    return gcd(b,a%b);
}
int main() {
#ifdef debug
    freopen("in.txt","r",stdin);
#endif
    int g;
    while(scanf("%d %d",&a,&b)!=EOF) {
        g=gcd(a,b);
        printf("%d %lld\n",g,(lint)a*b/g);
    }
}

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


int main(){
	int a, b, tmp, x, y, z;
	while (true){
		cin >> a >> b;
		if (cin.eof()){
			break;
		}
		if (a < b){
			 tmp = a;
			 x = b;
		}
		else {
			x = a;
			tmp = b;
		}
		while (tmp != 0) {
			y = tmp;
			tmp = x % y;
			x = y;
		}
		z = a / y * b;
		cout << to_string(y) << " " << to_string(z) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int p,int q){
  int s;
  while(q){
    p%=q;
    s=p;
    p=q;
    q=s;
  }
  return p;
}
int main(){
  int g,p,q;
  while(cin>>p>>q){
    g=gcd(p,q);
    cout<<g<<" "<<p/g*q<<endl;
  }
  return 0;
}

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=1;i<min(a, b);i++){
    if(a%i==0 && b%i==0){
      max = i;
    }
  }
  return max;
}

int find_LCM(int a, int b){
  int LCM;
  for(int i = max(a, b)+1;;i++){
    if(i%a==0 && i%b==0){
      LCM = i;
      break;
    }
  }

  return LCM;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
        cout << find_GCD(a, b) << " " << find_LCM(a, b) << endl;
  }

}

C++: #include <iostream>

template <typename T> T gcd(T a, T b) {
	T r;

	while (b) {
		r = a % b;
		a = b;
		b = r;
	}

	return a;
}

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

int main() {
	using namespace std;
	for (;;) {
		int a, b;
		cin >> a >> b;
		if (cin.eof()) { break; }

		int g = gcd(a, b);
		int l = lcm(a, b);
		cout << g << ' ' << l << endl;
	}
	return 0;
}

C++: #include <iostream>
 
//calc G.C.D(m >= n)
int calcGcd(int m, int n){
    return n == 0 ? m : calcGcd(n, m%n);
}
//calc L.C.M
inline int calcLcm(int m, int n, int gcd){
    return m / gcd * n;
}

int main(){
	
    int a, b;
    // input
    while(std::cin >> a >> b){
        int gcd, lcm;
         
        if(a > b) gcd = calcGcd(a, b);
        else gcd = calcGcd(b, a);
        lcm = calcLcm(a, b, gcd);
        // output
        std::cout << gcd << " " << lcm << std::endl;
    }
     
    return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);++i)

ll a,b;

ll gcd(ll a,ll b){
	if((0==a)||(0==b)) return 0;
	
	while(a!=b){
		if(a>b) a -= b;
		else b -= a;
	}
	return a;
}

ll lcm(ll a,ll b){
	if((a==0)||(b==0)) return 0;
	
	return ((a/gcd(a,b)) * b);
}

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

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
 
 
long long pgcd(long long a,long long b)
{
    return a==0?b:pgcd(b%a,a);
}
 
long long ppcm(long long a,long long b)
{
    return a*b/pgcd(a,b);
}
 
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<pgcd(a,b)<<" "<<ppcm(a,b)<<endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
int main(){
	int a, b, product;

  	while (std::cin >> a >> b) {
    	product = a * b;
		std::vector<int> v = {a, b};
    	while (v.at(0) != v.at(1)) { 
      		std::sort(v.begin(), v.end(), std::greater<int>());
      		v.at(0) = v.at(0) - v.at(1);
		}	
    	std::cout << v.at(0) << " " << product/v.at(0) << std::endl;	
  	}
	return 0;
}