Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: #include <stdio.h>

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

int main(){
	int a,b,n,m;
	
	while( scanf("%d %d", &a, &b) != EOF){
		n = gcd(a,b);
		m = lcm(a,b);
		printf("%d %d\n", n , m);
	}

	return 0;
}

C++: #include <stdio.h>

int gcd_num;

void gcd(int a, int b){
	int tmp;

	if(a < b){
		tmp = a;
		a = b;
		b = tmp;
	}

	tmp = a % b;
	if(tmp == 0){
		printf("%d ", b);
		gcd_num = b;
	}else{
		gcd(b, tmp);
	}
	return;
}

void lcm(int a, int b){
	printf("%d\n", gcd_num * (a / gcd_num) * (b / gcd_num));
}

int main(void){
	int a, b;
	int tmp;

	while(scanf("%d %d", &a, &b) != -1){
		gcd(a, b);
		lcm(a, b);
	}
}

C++: /*
 0005-GCD_and_LCM.cpp
 
 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        int temp_a = a;
        int temp_b = b;
        while(1){
            int l = max(temp_a,temp_b);
            int r = min(temp_a,temp_b);
            l = l-r;
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b,c,d;
    while (1){
        cin >> a >> b;
        if(cin.eof()){break;}
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

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

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

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;

}

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

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

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

using namespace std;

int a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a / gcd * b;
}




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

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

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

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

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

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

C++: #include <iostream>


using namespace std;

int main(){
	int a;
	int b;
	int ii = 1;
	cin >> a >> b;
	while (cin >> a >> b){
	for (int i = 0; i <= 2000000000; i++){
		int c = ii / a * a;
		int d = ii / b * b;
		if (ii == c&&ii == d){
			cout << a * b / ii <<  " " <<ii<< endl;
			break;
		}
		else ii++;

	}
	}

	return 0;
}

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

int main(void){
 
  long num1,num2,mul,gcd,lcm;
  
  while(cin >> num1 >> num2){
    mul = num1 * num2;

    /*GCD*/
    if(num1 >= num2){
      while(num2 != 0){
	gcd = num1 % num2;
	num1 = num2;
	num2 = gcd;
      }
      gcd = num1;
    }else{
      while(num1 != 0){
	gcd = num2 % num1;
	num2 = num1;
	num1 = gcd;
      }
      gcd = num2;
    }

    /*LCM*/
    lcm = mul / gcd;

    /*PRINT*/
    cout << gcd << " " << lcm << endl;      
  }
  return 0;

}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cin >> a >> b;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

#define INPUT_FROM_FILE (0)

#if INPUT_FROM_FILE
#include <fstream>
#endif

unsigned long gcd(unsigned long a, unsigned long b){
	unsigned long r = a % b;
	if(r == 0){
		return b;
	}
	else{
		return gcd(b, r);
	}
}

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif // INPUT_FROM_FILE
	unsigned long a = 0;
	unsigned long b = 0;

#if INPUT_FROM_FILE
	while(ifs >> a >> b){
#else
	while(std::cin >> a >> b){
#endif
		if(a < b){
			std::swap(a, b);
		}
		unsigned long g = gcd(a, b);
		std::cout << g << " " << (a / g) * b  << std::endl;
	}
	return 0;
}

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

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(2==scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),std::__gcd(a,b)*b);return 0;}

C++: #include<iostream>
using namespace std;
int main(){
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;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
 cout << lcm << ' ' << gcd << endl;
 retrun 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;
	}
	getchar();
	getchar();
	return 0;
}

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

long long GCD(long long X, long long Y) {
	if (Y == 0) return X;
	return GCD(Y, X % Y);
}

int main() {
	long long A, B;
	while (cin >> A >> B) {
		cout << GCD(A, B) << " " << A * (B / GCD(A, B)) << endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>

using namespace std;
int main()
{
 int x,y,n,a,b,gcf;
 while(cin>>x>>y)
 {
  a=x;
  b=y;
  while(x%y!=0)
  {
   n=x%y;
   x=y;
   gcf=n;
  }
  x=a;
  y=b;
 cout<<gcf<<" "<<(x*y)/gcf<<endl;
 }
return 0;
}

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

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

int main(void){
  long long int a,b;
  while(cin>>a>>b){
    long long int ma = max(a,b);
    long long int mi = min(a,b);
    cout<<gcd(ma,mi)<<" "<<lcm(ma,mi)<<endl;
  }
}

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;
	}
	getchar();
	getchar();
	return 0;
}