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>

int main( void ){
    float a[20],b[20];
    int nCount;
    for( int i = 0;scanf( "%f %f",&a[i],&b[i] ) != EOF;i++ ) nCount = i;

    for( int k = 0;k < i;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

C++: #include<iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#include <sstream>
typedef long long ll;
ll a,b,c,d;

ll gcd(ll a,ll b){
	c=1;
	while(c>0){
		if(a<b){switch(a,b);}
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}
ll lcm(ll a,ll b){
    d=a*b/gcd(a,b);
	return d;
}

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

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        int x = a;
        int y = b;
        while(y)
        {
            x = x%y;
            swap(x,y);
        }
        cout<<x<<" "<<a/x*b<<endl;
    }
    return 0;
}

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

int main(){
	int a, b;
	int m, n, r;
	while(cin >> a >> b){
		m = max(a, b);
		n = min(a, b);
		r = m % n;

		while(r != 0){
			m = n;
			n = r;
			r = m % n;
		}

		cout << n << ' ' << min(a,b)*(max(a,b)/n) << endl;
	}

	return(0);
}

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

using namespace std;

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

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

C++: #include<cstdio>

int main() {
    unsigned long a, b, c, d, e;
    unsigned long kpk, fpb;
    while ( scanf("%ld %ld", &a, &b) != EOF ) {
          c = a;
          d = b;
          while ( c%d != 0 ) {
                e = c % d;
                c = d;
                d = e;
          }
          fpb = d;
          kpk = (a / fpb ) * b;
          printf("%ld %ld\n", fpb, kpk);
    }
    return 0;
}

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

C++: #include<stdio.h>
#include<math.h>

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

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
    long long a, b, n, s, k=0, i=0, c;
    while(cin >> c>> b){
        a=max(c, b);
        b=min(c, b);      
    for(i=b; i>=1;i--){
             if(b%i==0 && a%i==0)
             break;    
    }
    cout<<i<<" "<<(a*b)/i<<endl;
    }
    return 0;
}

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

int gcd(int a,int b){
	int maxa[2000000000],maxb[2000000000],GCD,i,j;
	
	for(i=2;i<a;i++){
		if(a%i == 0){
			a = a/i;
			for(j=0;j<a;j++)
				maxa[j] = i;
		}
	}
	for(i=2;i<b;i++){
		if(b%i == 0){
			b = b/i;
			for(j=0;j<b;j++)
				maxb[j] = i;
		}
	}
	for(j=0;j<a||j<b;j++){
		if(maxa[j] == maxb[j])
			GCD = maxa[j];
	}
	
	return GCD;
}

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

	return 0;
}

C++: #include<stdio.h>

int GCD(int x,int y)
{
	if(y==0)
		return x;
	return GCD(y,x%y);
}

int LCM(int x,int y)
{
	for(int i=1;i<=y;i++)
	{
		if((x*i)%y==0)
			return x*i;
	}
	return x*y;
}

int main()
{
	int x,y;
	scanf("%d%d",&x,&y);
	if(x>y)
	{
		int temp=y;
		y=x;
		x=temp;
	}
	printf("%d %d",GCD(x,y),LCM(x,y));
}

C++: #include <iostream>
long gcm(long a,long b){
    if (b==0) return a;
    return gcm(b,a%b);
}
 
int main(void){
    long a,b,x;
    while (std::cin>>a>>b){
        x=gcm(a,b);
        std::cout<<x<<" "<<a/x*b<<"\n";
    }
}

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

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}

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

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

int main(){

int small,big,i,c,kouyaku,koubai;

while(cin >> small >> big){

if(small>big){//大小比較
c=big;
big=small;
small=c;
}

for(i=1;i<=big;i++){//最大公約数
if(big%i==0 && small%i==0)kouyaku=i;
}

koubai=(big*small)/kouyaku;

cout << kouyaku << " " <<koubai << endl;//出力
}
return 0;
}

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

std::uint32_t calc_gcd(std::uint32_t a, std::uint32_t b)
{
	if (a % b == 0) {
		return b;
	}
	return calc_gcd(b, a % b);
}

int main()
{
	std::uint32_t a, b;
	while (std::cin >> a >> b) {
		std::uint32_t const gcd = calc_gcd(std::max(a, b), std::min(a, b));
		std::uint32_t const lcm = a / gcd * b;
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <math.h>

int main(void);
unsigned int gcd(unsigned int x, unsigned int y);
unsigned int lcm(unsigned int x, unsigned int y);

int main(){
	int dataset_count = 0;
	unsigned int first_num = 0;
	unsigned int second_num = 0;

	std::vector<unsigned int> first_num_vector;
	std::vector<unsigned int> second_num_vector;

	//while (dataset_count < 2){
		//std::cin >> first_num >> second_num;
	while ((std::cin >> first_num >> second_num)/* || (dataset_count < 50)*/){
		dataset_count++;
		first_num_vector.push_back(first_num);
		second_num_vector.push_back(second_num);
	}
	for (unsigned int i = 0; i < first_num_vector.size(); i++){
		std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl;
	}
	return 0;
}


// 最大公約数を求める関数
unsigned int gcd(unsigned int x, unsigned int y)
{
	unsigned int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

//	最小公倍数を求める関数
unsigned int lcm(unsigned int x, unsigned int y)
{
	unsigned int rtn;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	rtn = (x / gcd(x, y)) * (y / gcd(x, y));

	return rtn * gcd(x, y);
}

C++: #include <iostream>

inline int calcGcd(int x,int y){
	while(x % y != 0){
		int num = x % y;
		x = y;
		y = num;
	}
	return y;
}

inline int calcLcm(int x,int y){
	return x / calcGcd(x,y) * y;
}

int main(){
	int a,b;
	while(std::cin >> a >> b)
		std::cout << calcGcd(a,b) << " " << calcLcm(a,b) << std::endl;
}