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<vector>
#include<algorithm>
#include<string>

#define add push_back
#define inf 2147000000

#define rep(i,n) for(int i=0;i<n;i++)
#define deb(a) cout<<a<<endl
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	int a,b,bin;
	while(scanf("%d",&a)!=EOF){
		scanf("%d",&b);
	int aa=a,bb=b;
	if(a<b){
		swap(a,b);
	}
	
	while(b != 0){
		
		bin=a%b;
		a=b;
		b=bin;
	}
	
	out(a);
	out(aa+bb/a);
	}
}

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

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

int main(void){
    int a, b, tmp;
    if (a < b){
        tmp = b;
b = a;
a = tmp;

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

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

int main(void){
     long int n,m;
     long int c,e;
     long int l;
     cin >> n >> m;
     c = n;
     e = m;
     while(1){
	  if(c==e){
	       break;
	  }else if(c>e){
	       c = c-e;
	  }else if(c<e){
	       e = e-c;
	  }
     }
     l = (n*m)/c;
     cout << c << " " << l << endl;
     return 0;
}

C++: #include <iostream>
#include <algorithm>
#define llong long long
llong gcd(llong a, llong b)
{
    llong mod;
    mod = std::max(a, b) % std::min(a, b);
    if(mod == 0) return std::min(a, b);
    else return gcd(std::min(a, b), mod);
}
llong lcm(llong a, llong b, llong gcd)
{
    return (a * b) / gcd;
}
int main()
{
    llong a, b;
    while(std::cin >> a >> b)
    {
        llong g = gcd(a, b);
        std::cout << g << " " << lcm(a, b, g) << std::endl;
    }
}

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

int main(){
	int a, b, gcd, lcm, x, y, r;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int lcm(int a,int b);
int main(){
	for(;;){
		int a,b;
		if(scanf("%d %d",&a,&b) == EOF){break;}
		int x = lcm(a,b);
		int y = a/x*b;
		cout <<x<<" "<<y<<endl;
	}
	return 0;
}
int lcm(int a,int b){
	if (a == 0){return b;}
	return lcm(b%a,a);
}

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

using namespace std;

int gcm(int a, int b){
	
	if(b > a){
	int d;
	d = a;
	a = b;
	b = d;
	}	
	
	int c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	
	}
	return a;
}

int main(){
	long long c,d,e;
	std::cin>>c>>d;

	e = gcm(c,d);

	std::cout<<e<<" "<<(c*d)/e;
}

C++: #include<iostream>
using namespace std;
int main(){
  int sn,bn;
  int p,lcm,gcd;
  while(cin>>sn>>bn){
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0){
      lcm = i;
      break;
    }
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0){
      gcd = i;
      break;
    }
  }
  cout << gcd << ' '<< lcm <<endl;
  }
  return 0;
}

C++: #include<cstdio>

int gcd(int a, int b){
    if(a == b)
        return a;
    else if(a > b)
        a -= b;
    else if(a < b)
        b -= a;
    return gcd(a, b);
}

int lcm(int a, int b){

    return (a / gcd(a, b)) * (b / gcd(a, b)) * gcd(a, b);
}

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

C++: 
#include <string>
#include <iostream>
#include <sstream>

unsigned long __gcd(unsigned long a, unsigned long b)
{
//    std::cout << "in __gcd\n";
//    std::cout << "a: " << a << "\nb: " << b << '\n';
    if (b % a == 0) {
//        std::cout << "returning " << a << '\n';
        return a;
    } else {
        return __gcd(b % a ,a);
    }
}

unsigned long gcd(unsigned long a, unsigned long b)
{
    if (a > b)
        return __gcd(b, a);
    return __gcd(a, b);
}

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

int main(void)
{
    int a, b;
    std::string str;

    while (getline(std::cin, str)) {
        std::istringstream str_s(str);
        str_s >> a >> b;

        std::cout << gcd(a, b) << ' ' << lcm(a, b) << std::endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int gcdf(unsigned long long int a,unsigned long long int b);
int gcd(unsigned long long int a,unsigned long long int b);

int main(){
 	unsigned long long int a,b;
	unsigned long long int G,L;
	 
	while(cin>>a>>b){
		G=gcd(a,b);
		L=(a*b)/G;
		cout<<G<<" "<<L<<endl;
		
}
}
	
int gcdf(unsigned long long int a,unsigned long long int b)
{
	return (b == 0?a:gcdf(b,a%b));
}

int gcd(unsigned long long int a,unsigned long long int b)
{
	return (a>b?gcdf(a,b):gcdf(b,a));
}

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

int main() {
  long a,b;

  while(std::cin >> a >> b) {
    long gcd = 1;
    long lcm = 1;

    for(int cnt = (a < b ? a : b); cnt > 1; --cnt) {
      if((a % cnt == 0) && a % cnt == b % cnt) {
        a /= cnt;
        b /= cnt;
        gcd *= cnt;
      }
    }
    lcm = gcd * a * b;
    std::cout << gcd << " " << lcm <<std::endl;
  }

}

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

int main(){
	int a, b, r, x, y;

	while ( cin >> a >> b ){

		if ( a >= b ){
			x = a;
			y = r = b;
		}else{
			x = b;
			y = r = a;
		}

		while ( 1 ){
			r = x % y;
			if ( !r ) break;
			x = y;
			y = r;
		}

		x = ( a * b ) / y;

		cout << y << " " << x << endl;
	}

	return 0;
}

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

long gcd(long a, long b)
{
	return(b?gcd(b,a%b):a);
}

int main(void)
{
	long long x,y;
	while(cin >> x >> y){
	cout << gcd(x,y) << " " << x*y/gcd(x,y)<< endl;
	}
	return(0);
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n, m;
    while (2 == scanf("%d%d", &n, &m)) {
        printf("%d %d\n", __gcd(n, m), n / __lcm(n, m));
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
	while(m!=n)m>n?m-=n:n-=m;
  		//if (m>n) m = m - n;
  		//else n = n - m;
	return m;
}
ll lcm(ll m,ll n){return ((m/gcd(m, n))*n);}
int main(){
	ll a,b;
	while(cin>>a>>b)cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
}