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 <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<iostream>
#include<fstream>
using namespace std;


unsigned long long int GCM(unsigned long long int a,unsigned long long int b){
	while(a!=b){
		a>b? a-=b:b-=a;
	}
	return a;
}

int main()
{
	unsigned long long int a,b,L,G;
	
	cin>>a;
	do{
	cin>>b;
	if(a!=0&&b!=0){
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}
	}while(cin>>a);
	cin>>a;
}

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

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

int main(){
	
	while(true){
		int a,b;
		cin >> a >> b;
		
		if(cin.eof()) break;
		
		int g = gcd(a,b);
		cout << g << ' ' << a/g*b << endl;
		
	}
	
	return 0;
	
}

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

int gcd(int a, int b){
	if(b==0)
		return a;

	return gcd(b,a%b);
}

int main(){
	while(true){
		int a,b;
		cin >> a>> b;
		
		if(cin.eof())
			break;

		int g=gcd(a,b);
		cout << g <<' '<<a/g*b <<endl;
	}
	
	return 0;
}

C++: //
//  main.c
//  c
//
//  Created by ????????? on 2016/12/10.
//  Copyright ?? 2016??´ ?????????. All rights reserved.
//

#include <stdio.h>
#include "0005.h"
int main(){
    long long a, b, r, lcm, x, y;
    while (scanf("%lld %lld",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%lld %lld\n",y,lcm);
    }

    return 0;
}

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++: # -*- coding: utf-8 -*-
import sys

def gcd(a,b):
    while a%b:
        a,b = b,a%b
    return b

def lcm(a,b):
    return a*b/gcd(a,b)

for s in sys.stdin:
    a,b = map(int,s.split())
    a,b = max(a,b),min(a,b)
    print gcd(a,b),lcm(a,b)

C++: #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
typedef long double lb;
using namespace std;
ll gcd(ll P, ll Q){
  return Q ? gcd(Q,P % Q):P;
}
ll lcm(ll P, ll Q){
  return P / gcd(P,Q) * Q;
}
int main(){
  ll P,Q;
  while(cin >> P >> Q){
    cout << gcd(P,Q) << " " <<  lcm(P,Q) << endl;
  }
}

C++: #include "iostream"
using namespace std;

void keisann(int a,int b) {
	int ac = a;
	int bc = b;
	while (true) {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			break;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) /a << endl;
			break;
		}
	}
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << a << " "<< a<<endl;
		}
	}
	return 0;
}

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

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 << ' ' << a*b/n << endl;
	}

	return(0);
}

C++: #include<iostream>

using namespace std;

int gcd(int x,int y) {//??????????????????????????????
	int r;
	if (x < y)swap(x, y);
	while (y > 0) {
		r = x%y;
		x = y;
		y = r;
	}
	return x;
}

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

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

typedef unsigned int uint;

uint func1(uint a,uint b){
    while(a != b){
        if(a>b)a-=b;
        else b-=a;
    }
    return a;
}

uint func2(const uint a,const uint b){
    uint a2=a,b2=b;
    while(a2 != b2){
        if(a2>b2)b2+=b;
        else a2+=a;
    }
    return a2;
}

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

    cout << func1(a,b) << " " << func2(a,b);

    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;

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

}
int main()
{
    ll a,b,c,d;
    cin >> a >> b;
    c=gcd(a,b);
    d=lcm(a,b);
    cout << c <<' ' << d << endl;
    return 0;
}

C++: #include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

inline int get_LCM(const u_int a, const u_int b, const u_int GCD)
{
    return a * (b / GCD);
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << get_LCM(a, b, GCD) << std::endl;
    }    

    return 0;
}

C++: #include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y){

    if(x<y) return gcd(y,x);
    if(y==0) return x;
    return gcd(y,x%y);

}

int main(){

    cin.sync_with_stdio(false);

    while(1){

        long long x,y;

        cin >> x >> y;

        long long m = gcd(x,y);

        cout << m << " " << x/m * y << endl;

    }

    return 0;

}

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

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

void gcd(int a,int b)
{
  int ans,p,q[10000];

  p=max(a,b); q[0]=min(a,b);
  for(int i=0;;i++){
    if(!q[i]){
      cout<<p<<" "; break;
    }
    q[i+1]=p%q[i]; p=q[i];
  }
}

int lcm(int a,int b)
{
  int ans=0,p=min(a,b),q=max(a,b);

  for(int i=1;;i++){
    for(int j=1;;j++){
      if(p*i==q*j){
	ans=p*i; break;
      }
      if(p*i<q*j) break;
    }
    if(ans) break;
  }
  cout<<ans<<endl;
}

int main()
{
  int a,b;

  while(cin>>a>>b){
    gcd(a,b); lcm(a,b);
  }
}

C++: #include <iostream>
using namespace std;
long a1,a2;
long gcd,lcm;

long GCD(long a,long b){
    long i = 2;
    long minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (i = 1; i <= minimum; i++) {
            if (a % (minimum - i + 1) == 0 & b % (minimum - i + 1) == 0) {
                i = minimum - i + 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}