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 <stdio.h>
using namespace std;

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 / (double)gcd(num1, num2) * num2;
}

int main() {
	long a, b;
	while (~scanf("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),(long)lcm(a,b));
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;

const int INF = 1 << 29;
const double EPS = 1e-10;

double zero(double d) {
    return d < EPS ? 0.0 : d;
}

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    os << '[';
    rep(i, a.size()) os << (i ? " " : "") << a[i];
    return os << ']';
}

// to avoid error on mingw
string toString(int i) {
    stringstream ss;
    ss << i;
    return ss.str();
}

const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
    ll res = 1ll;
    ll x = a;
    while (k != 0) {
        if ((k & 1) == 1)
            res = (res * x) % M;
        x = (x * x) % M;
        k >>= 1;
    }
    return res;
}

int gcd(int a, int b) {
    if(a == 0)
        return 1;
    if(b == 0)
        return a;
    return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a / gcd(a,b) * b;
}

int main() {
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(8);
    ios_base::sync_with_stdio(false);

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

    return 0;
}

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

int main() {
	int a, b, c, d, e, f, g, l;
	while (cin >> a >> b,!cin.eof()) {
		c = a; d = b;
		e = a; f = b;
		while (1) {
			if (a > b) {
				a %= b;
				if (a == 0) { g = b; break; }
			}
			else if (a<b) {
				b %= a;
				if (b == 0) { g = a; break; }
			}
		}
		while (1) {
			if (c>d) d += f;
			else if (c < d) c += e;
			if (c == d) { l = c; break; }
		}
		cout << g << " " << l << endl;
	}
}

C++: #include<iostream>

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

int main(){
  int a, b, k;

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

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

int main()
{
	int a, b;
	int temp;
	while (cin >> a >> b)
	{
		if (a < b)
		{
			temp = a;
			a = b;
			b = temp;
		}
		int a_ = a, b_ = b;
		while (a_ % b_ != 0)
		{
			temp = a_ % b_;
			a_ = b_;
			b_ = temp;
		}
		cout << b_ << " " << a * b / b_ << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define p pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<d;
#define OUTL(d) cout<<d; BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))
 
ll gcd(ll x, ll y){
    if(y == 0) return x;
    return gcd(y, x%y);
}

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

signed main(){ INIT;
    ll x, y;
    while(cin >> x){
        cin >> y;
        OUT(gcd(x, y)); SP; OUTL(lcm(x, y));
    }
RET;}

C++: #include<bits/stdc++.h>
using namespace std;
int gcd(long long a,long long b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		if(b>a) swap(a,b);
		long long t=gcd(a,b);
		cout<<t<<' '<<a/t*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (; i <= minimum; i++) {
            if (a % (minimum - i + 2) == 0 && b % (minimum - i + 2) == 0) {
                i = minimum - i + 2;
                break;
            } else if (i == minimum) {
                i = 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: #include <stdio.h>

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(scanf("%d%d",&a,&b) != EOF){
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);
  }

  return 0;
}

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

int main() {
    
    int a,b;
    while(cin >> a >> b){
        for(int i = a;i > 1;i--){
            if(b%i == 0 && a%i == 0){
                cout << i << "\n";
                break;
            }
        }
        for(int i = a;i < 2000000000;i++){
            if(i%a == 0 && i%b == 0){
                cout << i << "\n";
                break;
            }
        }
    }
    
return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

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

int main()
{
    int a, b;

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