Go: package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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

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

    int max = max(a,b);
    int min = min(a,b);

    int gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j; break;
      }
      else{ 
        i++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

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

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

C++: #include <iostream>
using namespace std;
typedef unsigned long long ull;

ull gcd(ull m, ull n) {
    ull r;
    if (m < n) swap(m,n);
    if (n == 0) return m;
    return gcd(n, m % n);
}

ull lcm(ull m, ull n) {
    return (m * n) / gcd(m, n);
}

main() {
    ull a,b;
    while(cin>>a) {
        cin>>b;
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

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

unsigned GCD(unsigned a, unsigned b)
{
    if (!b) return a;
    return GCD(b, a%b);
}

unsigned LCM(unsigned a, unsigned b)
{
    return a / GCD(b, a-b) * b;
}

int main(void)
{
    unsigned a, b;
    while (scanf("%u %u", &a, &b) != EOF) {
        if (a < b) swap(a, b);
        printf("%u %u\n", GCD(a, b), LCM(a, b));
    }

    return 0;
}

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 <<endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b)
{
    while( 1 )
    {
a = a % b;
if( a == 0 )return b;
b = b % a;
if( b == 0 )return a;
    }
}

return a;
}

int main()
{
ll a,b;
while(~scanf("%lld %lld",&a,&b)){
printf("%lld %lld",gcd(a,b),(a*b)/gcd(a,b));
}
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

unsigned long gcd(unsigned long a, unsigned long b) {
	if(a == 0 || b == 0) return 0;
	while(a != b) {
		if(a > b) a -= b;
		else b -= a;
	}
	return a;
}

unsigned long lcm(unsigned long a, unsigned long b) {
	if(a == 0 || b == 0) return 0;
	return (a / gcd(a, b)) * b;
}

int main() {
	unsigned long a, b;
	unsigned int arg[0xfFf][2] = { 0 };
	int cnt = 0;
	while(scanf("%d %d", &a, &b) != EOF) {
		arg[cnt][0] = a;
		arg[cnt++][1] = b;
	}
	int i;
	for(i = 0; i < cnt; i++) {
		printf("%d %d\n", gcd(arg[i][0], arg[i][1]), lcm(arg[i][0], arg[i][1]));
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
long long   a,b,ta,tb;
     
    while(cin>>a>>b){
    ta=a;tb=b;
    if(a<b)swap(a,b);
    while(true){
       long long tmp=a;
        a=b;
        b=tmp-b;
        if(a-b==0)break;
    }
    cout<<b<<" "<<ta*tb/b<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>

typedef long long ll;
using namespace std;

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

int main()
{
ll a,b;
while(~scanf("%lld %lld",&a,&b)){
printf("%lld %lld",gcd(a,b),a/gcd(a,b)*b);
}
}

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 = b * a / gcd(a,b);
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main()
{
	int a,b;
	cin>>a;
	while((getchar())!=EOF)
	{ 
		cin>>b;
		int i,G,L,temp;
		if(a>b)
		{
			temp=b;
		}
		else
		{
			temp=a;
		}
		for(i=1;i<=temp;i++)
		{
			if(a%i==0&&b%i==0)
			L=i;
		}
	    
		G=(a*b)/L;
		cout<<L<<" "<<G;
		cin>>a; 
		
	}
	return 0;
}

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

int gcd(unsigned int a , unsigned int b){
	if (a<b) {
		a^=b;
		b^=a;
		a^=b;
	}
	return a%b ? gcd(a , a%b) : b;
}

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

int main(){
	unsigned int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , lcm(a , b));
	}
}

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

int gcd( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	while( m != n ){
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}
int lcm( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	return ((m / gcd(m, n)) * n); 
}
int main(){
	int m, n;
	while(cin >> m >> n){
		cout << gcd(m,n) << " " << lcm(m,n) << endl;
	}
}

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

int gcd(int a, int b) {
  	int q,r;
	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 <iostream>
int Gcd(int a, int b) // Greatest Common Divisor
{
    if (!a || !b) {
        return 0;
    }
    while (a != b) {
        if (a < b) 
            std::swap(a, b);
        a -= b;
    }
    return a;
}
int Lcm(int a, int b, int gcd) // Least Common Multiple
{
    if (!a || !b) {
        return 0;
    }
    return a * (b / gcd); // 桁あふれ防止のために計算順序考慮
}
int main()
{
    int a, b, gcd;
    while (std::cin >> a >> b) {
        gcd = Gcd(a, b);
        std::cout << gcd << " " << Lcm(a, b, gcd) << "\n";
    }
}

C++: #include<iostream>

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

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

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