Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

C++: #include<iostream>
#include<vector>
using namespace std;
#define DBG cout<<"!"<<endl;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    if(bet!=0)
      les=b%bet;
    if(bet==0)
      max=a;
    else if(les==0)
      max=bet;
    else{
      for(;;){
	ch1=bet%les;
	if(ch1==0){
	  max=les;
	  break;
	}
	bet=les;
	les=ch1;
      }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=a;
			else{
				maxx=a%d;
				if (maxx==0)maxx=d;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

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

int main(){
   int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      while(1){
         if(a<b){
            tmp=a;
            a=b;
            b=tmp;
         }
         if(a%b==0){
            m=b;
            break;
         }else a=a%b;
         }
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<cmath>
using std::cout;using std::endl;
using std::cin;
int gcd(int a,int b,int c){
	int i=1;
	int r;
	while(true){
		if(a%i==0 && b%i==0)
			r=i;
		i++;
		if(i==a || i==b)
			break;
	}
	return r;
}
int main(){
  int n,m;
  while(cin>>n>>m){
	  cout<<gcd(n,m,n/2)<<" ";
	  cout<<(n/gcd(n,m,n/2))*(m/gcd(n,m,n/2))*gcd(n,m,n/2)<<endl;
  }
  return 0;
}

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

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

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

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

}

int main(void){
   int a, b, tmp;
   if (a < b){
       tmp = b;
	b = a;
	a = tmp;

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

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

int gcd(int a, int b);

int main()
{
	int a, b;

	while (cin >> a >> b, cin.eof() != true){
		cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;
	}

	return (0);
}

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

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

long long int gcd(long long int m,long long int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

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

C++: #include <iostream>
#include <stack>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
using namespace std;

int main() {
	int a, b;
	int x, y;
	int c;
	c = 0;

	while (cin >> a) {
		cin >> b;
		long long int m = a;
		long long int n = b;
		int r1, r2;
		int gcd, lcm;
		
		if (a < b) {
			c = a;
			a = b;
			b = c;
		}
		r1 = a % b;
		r2 = r1;

		while (r2 != 0) {
			r1 = r2;
			r2 = b % r1;
			b = r1;
		}
		gcd = b;
		lcm = (m * n) / gcd;

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

	}

	return 0;
}

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

int main()
{
	int a,b,c,num1,num2,GCD,LCM;

	while(cin >> a >> b){

	//????????????
	if(b < a){
		num1 = a;
		a = b;
		b = num1;
	}
	num1 = a; num2 = b;
	//????????????????????????????????????????????§??¬?´???°????±???????
	while((b%a)!=0){
		c = b%a;
		b = a;
		a = c;
	}
	
	GCD = a;
	
	//????°???¬?????°????±???????
	
	LCM = (num1 / GCD) * num2;
	
	//???????????¨?????????
	cout << GCD << " " << LCM << endl;
	
	}
	
	return 0;
}

C++: #include<stdio.h>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x<y)?x:y)

int prime[30000];	//soinsuu_分解用に素数を求めておく.
int count;
int soinsuu_A[30000],soinsuu_B[30000];	//soinsuu_を入れる。

int GetPrime(int num);	//num以下の素数をprime[i]に保存
void DevPrime(int *p,int num);	//numをsoinsuu_分解。soinsuu_prime[i]の数を*(p+i)に保存。
int GetLCM(int *pa,int *pb);
int GetGCD(int *pa,int *pb);

int pwd(int tei,int sisuu){
	int ans = 1;
	for(int i = 0;i < sisuu;i++)
		ans *= tei;
	return ans;
}

int main(){
	count = GetPrime(50000); 

	int a,b;
	int LCM[200],GCD[200],cor = 0;
	while(~scanf("%d%d",&a,&b)){
		DevPrime(soinsuu_A,a);
		DevPrime(soinsuu_B,b);
		LCM[cor] = GetLCM(soinsuu_A,soinsuu_B);
		GCD[cor] = GetGCD(soinsuu_A,soinsuu_B);
		cor++;
	}
	for(int i = 0;i < cor;i++)
		printf("%d %d\n",GCD[i],LCM[i]);
	return 0;
}

int GetPrime(int num){
	int count = 0,i,j;
	for(i = 2;i <= num;i++){
		for(j = 0;j < count;j++){
			if(i%prime[j] == 0)                                                                                                                                                                                                                                               
				break;
		}
		if(j < count)
			continue;
		prime[count] = i;
		count++;
	}
	return count;
}
void DevPrime(int *p,int num){
	int i;
	for(i = 0;i < count;i++){
		//保存したい配列を初期化
		p[i] = 0;
		//割りきれなくなるまでその素数で割る。
		while(num%prime[i]==0){
			num /= prime[i];
			p[i]++;
		}
	}
}
int GetLCM(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MAX(pa[i],pb[i]));
	}
	return ans;
}
int GetGCD(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MIN(pa[i],pb[i]));
	}
	return ans;
}

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int a, b;
	while (cin >> a >> b){
		int i, GCD, LCM;
		GCD = 0;
		if (a == b) {
			GCD = a;
			LCM = a;
		}
		else {
			if (a > b) {
				swap(a, b);
			}
			for (i = 1; i <= a || i <= b / 2; i++) {
				GCD = GCDr(a, b, i, GCD);
			}
			GCDr(a, b, i, GCD);
			LCM = a * b / GCD;
		}
		cout << GCD << " " << LCM << endl;
	}
}

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

int main(){
  long a, b;
  long l, m, n;
  while (1){
    cin >> a >> b;
    m = a;
    n = b;

    while (1){
      if (m <= n){
        int t = m;
        m = n;
        n = t;
      }

      if (n == 0){
        cout << m << " " << a * b / m << "\n";
        break;
      }

      l = m % n;
      m = n;
      n = l;

    }

    if (a <= 0 || b <= 0){
      break;
    }
  }

  return 0;
}