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>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
using namespace std;

int LCM(int a, int b) {
	int result = 1;
	int i = 2;
	while(i <= a && i <= b) {
		if (a % i == 0 && b % i == 0) {
			result *= i;
			a /= i;
			b /= i;
		}
		else i++;
	}
	return result;
}

int GCD(int a, int b) {
	int result = 1;

	int lcm = LCM(a, b);

	a /= lcm;
	b /= lcm;

	return a * b*lcm;


}

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

	while (cin >> a >> b) {




		printf("%d %d\n", LCM(a, b),GCD(a,b));

	}

	//system("pause");
	return 0;
}

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

C++: //#define _USE_MATH_DEFINES
#include <iostream>
//#include <stdio.h>
//#include <iomanip>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <cmath>

using namespace std;

long gcd(long a, long b){
	long A, B, R;

	if (a > b){
		A = a;
		B = b;
	}
	else{
		A = b;
		B = a;
	}

	while (1){
		R = A % B;
		if (R == 0){
			return B;
		}
		else{
			A = B;
			B = R;
		}
	}
}

long lcm(long a, long b){
	long A, B;

	A = a;
	B = b;

	while (1){
		if (A > B){
			B = ceil((float)A / (float)b) * b;
		}
		else{
			A = ceil((float)B / (float)a) * a;
		}

		if (A == B) return A;
	}

}


int main(){

	int n;
	long a, b;
	long gcd_a, lcm_a;


	while (cin >> a >> b){

		gcd_a = gcd(a, b);
		lcm_a = lcm(a, b);

		cout << gcd_a << " " << lcm_a << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j > 0){
		return gcd(j, i%j);
	}else{
		return i;
	}
	
}

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d,r,s,h;
	cin >> a >> b;

	//c
	h = a;
	s = b;
	for (;;){
		r = h % s;
		if (r == 0) {
			c = s;
			break;
		}
		h = s;
		s = r;
	}

	//d
	h = a;
	s = b;
	if (a < b){
		for (;;){
			if ((b % a)==0){
				d = b;
				break;
			}
			b = b + s;
		}
	}
	else if(a >= b){
		for (;;){
			if ((a % b) == 0){
				d = a;
				break;
			}
			a = a + h;
		}
	}

	cout << c << " "<< d;
	return 0;
}

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

int main(){
	int a,b;
	int i=1;
	int j=1;
	cin>>a>>b;
		while(1){
		if(a%i!=0){
			i++;
			continue;
		}
		if(b%j!=0){
			j++;
			continue;
		}
		if(a/i<b/j){
			j++;
			continue;
		}
		if(a/i>b/j){
			i++;
			continue;
		}
		if(a/i==b/j){
		cout<<a/i<<" ";
		break;
		}
	}
	
	i=1;
	j=1;
	while(1){
	if(a*i<b*j){
		i++;
		continue;
	}
	if(a*i>b*j){
		j++;
		continue;
	}
	if(a*i==b*j){
		cout<<a*i<<endl;
		break;
	}
	}
return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int a,b;
while(scanf("%d %d",&a,&b)!=EOF){
    long long int z=(long long)a*b;
    if(a<b)swap(a,b);
    while(b){
        int d=b;
        b=a%b;
        a=d;
    }
    printf("%d %lld\n",a,z/a);
}


return 0;
}

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

int main()
{
    unsigned long long a, b, _a, _b;

    while( cin >> a >> b )          //ユークリッドの互除法
    {
        _a = a;                     
        _b = b;

        while( a > 0 && b > 0)      //余りが0になるまで
        {
            if( a > b )
                a = a % b;
            else
                b = b % a;
        }

        cout << a + b << " " << _a * _b / ( a + b ) << endl;
    
    }

    return 0;
}

C++: #include <stdio.h>

int gcd(int a, int b) {
	int c = a%b;
	while (c) {
		a = b;
		b = c;
		c = a%b;
	}
	return b;
}

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

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

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

long int Gcm(long int a,long int b){

    long int temp=0;
    long int r=1;
    //aとbの最大公約数を求める
    //a,b入力を行う（a>b）。a=b*q+rの形で計算していく
    //b%rの値が０になったときのbがa,bの最大公約数(cとする)となる
    //最小公倍数は、c*a'=a,c*b'=bを満たすa',b'とcとの積である
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r = a%b;
        a = b;
        b = r;//aが最大公約数
    }
    return a;
}

int main(){
    long int x,y;
    long int gcd,lcm;

    cin >> x >> y;

    gcd = Gcm(x,y);

    x = x/gcd;
    y = y/gcd;

    lcm = x * y * gcd;

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

    return 0;
}

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

int GCD(int a, int b) { return (a % b ? GCD(b, a % b) : b); }
int LCM(int a, int b) { return ((a / GCD(a, b)) * b); }

int main()
{
  int a, b;
  while (scanf("%d %d", &a, &b) != EOF) {
    cout << GCD(a, b) << " " << LCM(a, b) << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a, int b) {
          int p,q,r;
       if(a<b){p=b;b=a;a=p; 
}

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

    while(r!=0){
    q=b/a;
    r=b%a;
    b=a;
    a=r;
    }
    return b;
}

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

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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
    std::cout << a << " " << b << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a %= b;
    }else{
      b %= a;
    }
  }
  
  if(a==1) return b;
  else     return a;
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0) return i;
      else i++;
    }else{
      i++;
    }
  }
}

C++: #include <iostream>

using std;

int main(){
    long a,b;
    a=0;b=0;
    cin >> a >> b;
    if(a<b) {
        long c;
        c=a;
        a=b;
        b=c;
    }
    long answer;
    long d,e,f;
    for(;;){
         if(e==f){
             answer = a*b/f;
             break;
         }
         d=e-f;
         e=f;
         f=d;
    }
    cout<<f<<" "<<answer<<endl;
    return 0;
}

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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
printf("%d %d\n",lcm, gcd);
    //std::cout << lcm << " " << gcd << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}