Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)1e5 + 5;

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

template<typename T>
T lcm(T m, T n)
{
	return ((m / gcd(m, n)) * n);
}

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

C++: #include <stdio.h>

int main(){
long int a,b,aa,bb;
long int x,y,q;

while(scanf("%d %d",&a,&b) != EOF){
aa=a;
bb=b;
while(a%b!=0){
x=a%b;
a=b;
b=x;
}
q=(aa*bb)/b;

printf("%d %d\n",b,q);
}
return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int gcd(int x,int y){
	int work=0,first=1,answer=0;
	if(x<=y){
		work=x;
		x=y;
		y=work;
	}
	while(1){
		first=x%y;
		if(first==0){
			answer=y;
			return answer;
		}
		x=y;
		y=first;
	}
}
int main(void)
{
	int a=0,b=0;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0){
			break;
		}
		else{
			cout<<gcd(a,b)<<" "<<(a*b)/gcd(a,b)<<endl;
		}
	}
	return 0;
}

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

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

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

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

long gcm(long a, long b){
	if (a<b) swap(a, b);

	if (a%b == 0)
		return b;
	else
		return gcm(b, a % b);
}

int main(void){

	while (true){
		long a, b, x, y;
		cin>>a>>b;
		if (cin.eof()) break;

		x = gcm(a, b);
		y = a / x * b;
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

C++: //0005 GCD and LCM
//üÍ³ê½2ÌÅåöñÆÅ¬ö{ðoÍ¹æ
//½¾µAÅåö{Í20­ð´¦È¢

#include<iostream>
using namespace std;

template<class T>
inline T GCD(T a, T b)
{
	T c;
	while( (c = a%b) != 0)
	{
		a = b;
		b = c;
	}
	return b;
}

template<class T>
inline T LCM(T a, T b)
{
	return (a / GCD(a, b) * b);
}

int main(void)
{
	int a, b;
	while( cin >> a >> b)
	{
		cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
	}
	return 0;
}

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

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

C++: #include<iostream>
#include<algorithm>
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;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		cout << gcd << " ";

		lcm = (a / gcd) * b;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

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

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

int solve(int a, int b) {
	int r;
	r = a % b;
	if (r == 0) return b;
	else return solve(b, r);
}

int main() {
	int a, b;
	int gcd, lcm;

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

	return 0;
}

C++: #include<cstdio>
int gcd(int a, int b){
  if(a == 0){
    return b;
  }else if(a > b){
    return gcd(a%b, b);
  }else if(a < b){
    return gcd(b%a, a);
  }
}
int main(){
  int a, b;
  while(scanf("%d%d", a, b)){
    int c=gcd(a,b);
    printf("%d %d\n", c, a*b/c);
  }
}

C++: #include  <stdio.h>
int main (void)
{
int i,j,a,b,c,e,f,bai[4] = {0},yaku[4] = {0};
	
	for(i = 0;i < 2;i++){
		scanf("%d %d",&a,&b);
		if(a > b){
			c = b; e = a;
		}	
		else{
			c = a; e = b;
		}
		
		if(e % c == 0){
			yaku[i] = c;
			bai[i] = e;
		}
		else{
			for(j = 1;j < c;j++){
				if(c % j == 0){
					f = c / j;
					if(e % f == 0){
						yaku[i] = f;
						j = e;
					}	
				}
			}
			if(yaku[i] == 0){
				yaku[i] = 1;
			}
			for(j = c;j > 0;j--){
				if(j * e <= 2000000000){
					if(j * e % c == 0){
						bai[i] = j * e;
					}	
				}
			}
		}
		
	}
	
	printf("%d %d\n%d %d",yaku[0],bai[0],yaku[1],bai[1]);
	
	return(0);
}

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

int GCD( int x , int y )
{
	if( x < y ){ swap( x,y ); }

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

int main()
{
	unsigned int a,b ;

	while( cin >> a >> b )
	{
		cout << GCD(a,b) << " " << a/GCD(a,b) * b << endl ;
	}

	return 0 ;
}

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

int main()
{
	long long a,b,m,n,d,e,f,i,c,k;
	while(cin>>a>>b)
	{
		if(a<b)
		{
			d=a;
			a=b;
			b=d;
		}
		e=a;
		f=b;
		c=a%b;
		 while (c!=0)   
         {
		 	a=b;
		 	b=c;
		 	c=a%b;
		  }
		n=b;
		k=(e*f)/n;
		m=k;
		cout<<n<<" "<<m;
		cout<<endl;
	}
	return 0;
 }

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

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

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

int main(){
    unsigned int a,b,c;
    int g,l,p;
    while(1){
        cin>>a>>b;
        p=a*b;
        while(b!=0){
            c=b;
            b=a%b;
            a=c;
        }
        g=a;
        l=p/g;
        cout<<g<<" "<<l<<endl;
    }
    return(0);
}

C++: #include<iostream>
int e(int a,int b){return(a%=b)?e(b,a):b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",c,a/c*b))c=e(a,b);}