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 "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll a,b;
    while(cin >> a >> b){
        ll GCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD = gcd(a,b);
        cout << GCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD << " " << a/GCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD*b<< endl;
    }
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
if(x==1){cout<<y<<" "<<y<<endl;}
else{cout<<y<<" "<<L<<endl;}
x=0;y=0;
  ++i;
  if(i==49){break;}
}
  return 0;
}

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

int main(){
	int a, b, min ,max, gcd, lcm;
	
	while(cin >> a >> b){
		
		min = min(a, b);
		max = max(a, b);
		
		for(int i = 0; i < min; i++){
			if(min % i == 0 && max % i == 0) gcd = i;
		}
		
		while(1){
			int i = 1;
			if( (max * i) % min == 0) {
				lcm = max *i;
				break;
			}
			else i++;
		}
		
		cout << gcd <<  " " << lcm << endl;
}

C++: #include <iostream>
using namespace std;
long long gcd(long long a,long long b)
    {
        if(b==0) return a;
        return gcd(b,a%b);
    }

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

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		long long tmp = 0;
		temp_a = a;
		temp_b = b;
		if (temp_a < temp_b){
			tmp = temp_a;
			temp_a = temp_b;
			temp_b = tmp;
		}
		while (temp_a % temp_b != 0){
			r = temp_a % temp_b;
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;


	}

	//getchar();

	return 0;
}

C++: #include <cstdio>
int a,b;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main(){
    while(~scanf("%d%d",&a,&b)){printf("%d %lld\n",gcd(a,b),1LL*a*b/gcd(a,b));}
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a, b,A, B;
	cin >> a >> b;
	int c = a;
	int d = b;
	if (a <= b)
	{
		while (a != 0)
		{
			int r = b%a;
			b = a;
			a = r;
		}
		A = b;
	}
	if (a > b)
	{
		while (b != 0)
		{
			int r = a%b;
			a = b;
			b = r;
		}
		A = a;
	}
	int e = c / A;
	B = d*e;
	cout << 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 <stdio.h>

int main(void){
	long a,b;
	long m,n;
	while(scanf("%ld %ld",&a,&b) != EOF){
		m = a;
		n = b;
		
		while(m != 0&&n != 0){
			if(m > n){
				m %= n;
			}else{
				n %= m;
			}
		}
		
		if(m > n){
			printf("%ld %ld\n",m,a/m*b);
		}else{
			printf("%ld %ld\n",n,a/n*b);
		}
	}
	return 0;

}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
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){
		cout<<gcd(a,b)<<" "<<(a/gcd(a,b)*b)<<endl;
		
	}
}

C++: #include <iostream>

using namespace std;

int main() {

	long long a, b;
	long long min, max;

	while (cin >> a >> b) {
		
		//?????§??¬?´???°????±???????
		//?????§??¬?´???°??????????????????????????????????????????????????§??????????????????????????£?????¨????????´??°??????
		max = 1;
		//a,b??????????°???????????????°?????§?????????
		for (long i = 2; i <= a&&i <= b; i++) {
			if (a%i == 0 && b%i == 0) {
				max = i;
			}
		}

		//????°???¬?????°????±???????
		//2,000,000,000?????§?????????
		long long i=1, j=1;
		while (a*i<2000000000&&b*j<2000000000) {
			//cout << "ai=" << a*i << " bj=" << b*j << endl;
			if (a*i == b*j) {
				min = a*i;
				break;
			}
			else if (a*i < b*j) {
				i++;
			}
			else if (a*i > b*j) {
				j++;
			}
			
		}

		cout << max << " " << min << endl;
	}

	return 0;

}

C++: #include<iostream>
using namespace std;
int main()
{
 int nA,nB,i;
  while(cin>>nA>>nB)
  {
    if(nA>=nB)
	 {
	  for(i=nB;;i--)
	   if(nA%i==0&&nB%i==0)
	     {
	    	cout<<i<<" ";
			break;
		 }
	   for(i=nA;;i++)
       if(i%nA==0&&i%nB==0)
	     {
	    	cout<<i<<endl;
			break;
		 }
	 }
	 else
	 {
        for(i=nA;;i--)
	   if(nA%i==0&&nB%i==0)
	     {
	    	cout<<i<<" ";
			break;
		 }
	   for(i=nB;;i++)
       if(i%nA==0&&i%nB==0)
	     {
	    	cout<<i<<endl;
			break;
		 }
	 }
   }
   return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		int tmp=a;
		a=b;
		b=tmp-b;
		if(a<b)swap(a,b);
		if(b==1){
		b=1;
		break;
		}
		if(a-b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

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

using namespace std;

int main(){
    int n, m, a, b, i=2, j=2, g;
    cin >> n >> m;
    
    a=n;b=m;
    while(a!=b){
        if(a<b) a=n*i++;
        else b=m*j++;
    }
    
    g = n*((double)m/a);
    printf("%d %d\n",g,a);
}

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

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

    }
    
    
}

C++: // 2014/04/27 Tazoe

#include <iostream>
using namespace std;

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

	return gcd(b, a%b);
}

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

		if(cin.eof())
			break;

		int g = gcd(a, b);
		cout << g << ' ' << a/g*b << endl;
	}

	return 0;
}