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>
#include <cstdio>
using namespace std;
//最大公約数
int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a%b);
}

//最小公倍数
int lcm(int a, int b) {
    int ret = gcd(a,b);
    ret = a*(b/ret);
    return ret;
}

int main(int argc, const char * argv[])
{
    int a, b;
    while (~scanf("%d %d", &a, &b)) {
        printf("%d %d\n", gcd(a, b), lcm(a, b));
    }
    return 0;
}

C++: /*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

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

int main()
{
	LL a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF)
	{
		LL gcdz=gcd(a,b);
		LL lcm=(a*b)/gcdz;
		printf("%I64d %I64d\n",gcdz,lcm);
	}
	
	return 0;
}

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

/*
8 6
50000000 30000000


2 24
10000000 150000000
*/

int A = 0;
int B = 0;

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

    return gcd(b, a % b);
}

void solve() {
    int d = gcd(A, B);
    int m = A / d * B;

    printf("%d %d\n", d, m);
}

int main() {
    while (scanf("%d %d", &A, &B) != EOF) {
        solve();
    }

    return 0;
}

C++: #include<cstdio>
#include<iostream>
     
using namespace std;
    
int gcd(int a, int b){

  if(b == 0)  return a;

  return gcd(b, a % b);
}
     
int lcm(int a, int b, int ans_gcd) {
  int ans;
  
  ans = a / ans_gcd * b;

  return ans;
}
     
     
     
     
int main(){
  int a, b;
  int ans_gcd, ans_lcm;

  while (cin >> a >> b) {
    if((a == 0) && (b == 0)) break;

    ans_gcd = gcd(a, b);
    ans_lcm = lcm(a, b, ans_gcd);

    cout << ans_gcd << " " << ans_lcm << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

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

int main(){
    int a, b;
    while(cin>>a>>b){
    	int g = gcd(a,b);
    	printf("%d %d\n", g, a*(b/g));
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<class T>T gcd(T a, T b) {if(b==0) return a; return gcd(b, a%b);}

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

int main()
{
    ll a, b;
    while(cin >> a>>b) printf("%lld %lld\n", gcd(a, b), lcm(a, b));
    return 0;}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

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

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

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

C++: #include <stdio.h>
 
using namespace std;
 
int calcMax(int a,int b){
    int tmp;
    if(a > b){
        while(b != 0){
            tmp = b;
            b = a%b;
            a = tmp;
        }
        return a;
    }else{
        while(a != 0){
            tmp = a;
            a = b%a;
            b = tmp;
        }
        return b;
    }
}
 
 
 
int calcMin(int a,int b){
    int max_common = calcMax(a,b);
    return (a/max_common)*b;
}
 
int main(){
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF){
        printf("%d %d\n",calcMax(a,b),calcMin(a,b));
    }
 
    return 0;
}

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

int main(){
    int a, b, lcm, gcd;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			if(_b % _a == 0){
				gcd = _a;
				break;
			}
			_a = _a % _b;
			std::swap(_a, _b);
		}
		lcm = a / gcd * b;
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: 
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
int main()
{
	long long a, b;
	while (cin >> a >> b)
	{
		int A, B;
		A = saisho(a,b);
		B = saidai(a, b);
		cout << A << " " << B<<endl;
	}
	return 0;

}
int saidai(int N, int M)
{
	int n = N, m = M;

	int s = 1;
	while (true)
	{
		if ((s*n) % m == 0)
		{
			break;
		}
		else { s++; }
	}
	return s*n;
}

int saisho(int N, int M)
{
	int n = N, m = M;
	while (true)
	{
		if (n == 0) { return m; break; }
		if (m == 0) { return n; break; }
		if (n > m) { n -= m; }
		else { m -= n; }
	}
}

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}