Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

using namespace std;

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

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

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

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

C++: #include<iostream>
using namespace std;
long long int gcd(long long int a, long long int b)// greatest common divisor 
{
	if (b == 0) {
		return a; 
	}
	return gcd(b, a%b);
}

long long int lcm(long long int a, long long int b)// least common multiple
{
	return a * b / gcd(a, b);
}

int main() {
	long long int a, b;
	while (cin>>a>>b) {
		cout << gcd(a, b) << ' ' << lcm(a, b)<<'\n';
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int GCD(int a, int b){
  return !b ? a : GCD(b, a%b);
}

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

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

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

int main() {
    
    int a,b;
    while(cin >> a >> b){
        for(int i = a;i > 1;i--){
            if(b%i == 0 && a%i == 0){
                cout << i << "\n";
                break;
            }
        }
        for(int i = a;i < 2000000000;i++){
            if(i%a == 0 && i%b == 0){
                cout << i << "\n";
                break;
            }
        }
    }
    
return 0;
}

C++: #include "stdio.h"

int main()
{
	int a, b, x, y;

	while(scanf("%d %d", &a, &b) != EOF){
		if(a < b) {int t; t = a; a = b; b = t;}

		for(int i = a-b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

C++: #include <iostream>

using namespace std;
//辗转相除法求解a,b的最大公约数，使用前a、b请自行取绝对值
int gcd(long long a,long long b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

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

C++: #include<cstdio>
int a,b,t;int g(int a,int b){return b?g(b,a%b):a;}
main(){while(~scanf("%d%d",&a,&b))printf("%d %d\n",t=g(a,b),a/t*b);}

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

typedef long long ll;

ll GCD(ll a, ll b) {
    if(b == 0)
	return a;
    return GCD(b,a%b);
}


ll LCM(ll a, ll b) {
    
    ll G = GCD(a,b);

    return a/G * b/G * G;

}

int main() {

    ll a,b;

    while(cin >> a >> b) {

	cout << GCD(a,b) << " " << LCM(a,b) << endl;
    }

    return 0;
}

C++: #include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
//#include <vector>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
int main(){
	int a, b;
	while (cin>>a>>b){
		int c = gcd(a, b);
		cout << c << " " << a / c*b << endl;
	}
	return 0;
}

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

int main() {
    long long int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

C++: #include <iostream>
using namespace std;
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

int gcd(int x,int y){
    if (y==0)return x;
    return gcd(MAX(x,y), MAX(x,y)%MIN(x,y));
}

int lcm(int x,int y){
    return x * y / gcd(x,y);
}

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;

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

int main(){
    int a,b;
    while(cin>>a>>b){
        int gcd_=gcd(a,b);
        long long lcm=a/gcd(a,b)*b;
        cout<<gcd_<<" "<<lcm<<"\n";
    }
}

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

C++: #include <cstdio>

unsigned gcd(unsigned a, unsigned b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  while (a % b != 0) {
    unsigned t = a;
    a = b;
    b = t % b;
  }
  return b;
}

int main() {
  unsigned a, b;
  while (true) {
    if (scanf("%d %d", &a, &b) != 2) { break; }
    unsigned d = gcd(a, b);
    unsigned m = a / d * b;
    printf("%d %d\n", d, m);
  }
  return 0;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
typedef pair<int,int> P;
typedef unsigned long long ll;
ll gcd(ll x,ll y){
    ll ma=max(x,y),mi=min(x,y),ama=ma%mi;
    if(ama==0) return mi;
    else return gcd(mi,ama);
}
ll lcm(ll x,ll y){
    ll g=gcd(x,y);
    if(g==1) return x*y;
    return g*lcm(x/g,y/g);
}
int main(){
    
    for(int i=0;i<50;i++){
        ll a,b;
        cin>>a>>b;
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
    return 0;
};

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

int main(){

  long long int a,b,c,r,s;

  while(cin >> a >> b){

    s=a*b;

    while(b!=0){

      c=a/b;
      r=a%b;
      a=b;
      b=r;

    }

    cout << a << ' ' << s/a <<  endl;
  }

  return 0;
}

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

int main() {
	int a = 0;
	int b = 0;
	int tmp = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a < b) {
			tmp = b;
			b = a;
			a = tmp;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= a_bk; c++) {
			while (a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;

			}
		}
		cout << d << '\n';
		d = a_bk * b_bk / d;
		cout << d << "\n";

	}
	return 0;
}

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

int gcd(int x,int y);

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

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

C++: // g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3

#define MAX_N 1000

ll a,b;

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y, x%y);
}

ll lcm(ll x, ll y){
	return (ll)(x*y/gcd(x,y));
}

int main(){
	while(scanf("%lld %lld", &a, &b)!=EOF){
		cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
	}
	return 0;
}