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>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

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

int gcd(int a, int b) {
  if (a < b)
    return gcd_h(b, a);
  else
    return gcd_h(a, b);
}

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

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

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

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    while (cin >> a >> b)
    {
        cout << __gcd(a,b) << " " << (long long)a*b/__gcd(a,b) << endl;
    }
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

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

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[3];

	tmp[0] = std::max( a, b );
	tmp[1] = std::min( a, b );

	for( n = 0;; n++ ){
		for( i = 1;; i++ ){
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i;
			if( tmp[( n + 2 ) % 3 ] < tmp[( n + 1 ) % 3 ] ){
				break;
			}else if( tmp[ n % 3 ] * tmp[( n + 1 ) % 3 ] * tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[0] + tmp[1] + tmp[2] - std::max( tmp[0], std::max( tmp[1], tmp[2] ));  
			}

			std::cout << "tmp[ n % 3 ] = " << tmp[ n % 3 ] << std::endl;
			std::cout << "tmp[( n + 1 ) % 3 ] = " << tmp[( n + 1 ) % 3 ] << std::endl;
			std::cout << "tmp[( n + 2 ) % 3 ] = " << tmp[( n + 2 ) % 3 ] << std::endl;
		}
	}

	return -1;
}

C++: #include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>

using namespace std;

int gcd(int m,int n){
	if(m == 0 || n == 0){
		return 0;
	}
	while(m != n){
		if(m > n){
			m -= n;
		}
		else{
			n -= m;
		}
	}
	return m;
}

int icm(int m,int n){
	if(m == 0 || n == 0){
		return 0;
	}
	return ((m / gcd(m,n)) * n);
}

int main(){
	int m = 0,n = 0;
	int resGcd = 0,resIcm = 0;
	while(cin >> m >> n){
		resGcd = gcd(m,n);
		resIcm = icm(m,n);
		cout << resGcd << " " << resIcm << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  for (Integer a, b; cin >> a >> b, cin; ) {
    int x = max(a,b);
    int y = min(a,b);
    while (y > 1) {
      x %= y;
      int t = x;
      x = y;
      y = t;
    }
    cout << x << ' ' << (a / x * b) << endl;

  }

  return 0;
}

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

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

void solve(int a, int b){
  if(a < b)
    swap(a, b);
  int gcd = GCD(a, b);
  cout << gcd << " " << a / gcd * b << endl;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    solve(a, b);
  }
}

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

using namespace std;

int gcd(int h,int l){
  if(h<l){
    swap(h,l);
  }
  while(h%l){
    h%=l;
    swap(h,l);
  }
  return l;
}

int main(){
  for(int a,b;cin>>a>>b;){
    cout<<gcd(a,b)<<' '<<a/gcd(a,b)*b<<endl;
  }
  return 0;
}

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

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a);
}

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

C++: #include <iostream>
using namespace std;
int main()
{int a, b, c = 0;while (cin >> a, cin >> b){for (int i = 1; i <= a, i <= b; i++){if (a % i == 0 && b % i == 0){c = i;}}cout << c << " " << a*b / c << endl;}return 0;}

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

int main(){
int a;
int b;
int c;
int d;
int e;
int f;
while(cin>>d>>e){
a=d;
b=e;
while(1){
c=a%b;
a=b;
b=c;
if(b==0){break;}
}
cout << a <<" ";
f=(d*e)/a;
cout << f <<endl;}}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	long long a,b,c,a1,b1,p,min,max;
	while(cin>>a>>b)
	{
		if(a<b){p=a;a=b;b=p;}
		a1=a;b1=b;
		while(a%b!=0)
		{
           c=a%b;
           a=b;
           b=c;
       }
		min=b;
		max=a1*b1/min;
		cout<<min<<" "<<max<<endl;
	}
	return 0;
}

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

//最大公約数
int gcd(int a, int b)
{
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}


//最小公倍数
int lcm(int a, int b)
{
    return ((a / gcd(a,b))*b);
}



int main(){

int a,b;

while(cin >> a >> b){
    if(a == -1 or b == -1)  break;
   while(a <= 0 or a>2000000000 or b <= 0 or b > 2000000000){
       cin >> a >> b;
   }
   if(a > 0 and b > 0){
        cout << gcd(a,b) << " "<< lcm(a,b)<< "\n";
    }
}

return 0;
}