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

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	cin >> a >> b;
	c = a;
	d = b;
	
	while(c != d){
		if(c < d){
			c = a * i;
			i++;
		}else if(c > d){
			d = b * j;
			j++;
		}
	}
	
	/**********************************/
	
	int e, f;
	int k = 2;
	int l = 2;
	e = a;
	f = b;
	
	while(e != f){
		if(e > f){
			e = a / k;
			k++;
		}else if(e < f){
			f = b / l;
			l++;
		}
	}
	
	
	cout << e << " " << c << endl;
	
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

	if(a > b) { return GCD(a % b, b); }

	if(a < b) { return GCD(a, b % a); }
}

int LCM(int a, int b)
{
	return a / GCD(a, b) * b;
}

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;

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

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

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

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int GCD(int x,int y)
{
	return y==0?x:GCD(y,x%y);
}
int a,b;
int main()
{
	while(~scanf("%d %d",&a,&b))
	{
		if(a<b)
			swap(a,b);
		printf("%d %d\n",GCD(a,b),a/GCD(a,b)*b);
	}
}

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

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a);
}

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

C++: #include <iostream>

using namespace std;

int main(){

	long a,b,c,d;

	while(cin>>a>>b){
		c=a;
		d=b;
		while(1){
			if(c>d)c=c-d;
			if(c<d)d=d-c;
			if(c==d){
				cout<<c<<" "<<a*b/c<<endl;
				;break;}
		}}
		


return 0;
}

C++: #include<stdio.h>


int Kouyakusu(int a,int d){

	if((a==0)||(d==0))
		return 0;
	

	while(a != d){

		if(a > d)
			a-=d;
		else
			d-=a;
	}

	return a;

}

int main(void){

	long int a,b;

	long int yaku;

	for(int i=0;i<2;i++){
	scanf("%d %d",&a,&b);

	yaku = Kouyakusu(a,b);

	if(yaku != 0)
		printf("%d %d\n",yaku, (a/yaku)*b);
	else
		printf("0 0\n");

	}
	return 0;

}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long a = 0;
	long long b = 0;
	while(cin >> a >> b)
	{
		long long GCD = 0;
		long long LCM = 0;
		if(a < b)
			swap(a,b);
		long long temp = a * b;
		while(a % b != 0)
		{
			long long t = a % b;
			a = b;
			b = t;
		}
		LCM = b;
		GCD = temp / LCM;
		cout << LCM << " " << GCD <<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	double a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = fmod(a,b);
			}else b = fmod(b,a);
		}
			cout << " " << c * d / min(a,b) << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

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

}

int lcm(int a,int b){

  return a/gcd(a,b)*b;

}

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

C++: #include <stdio.h>

int main( ){
    float a[20],b[20];
    int nCount = 0;
    while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){
        nCount++;
    }

    for( int k = 0;k < i;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    unsigned int a, b;
    while(cin >> a >> b){
        unsigned int _a = a, _b = b;
        unsigned int gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

C++: #include <algorithm>
#include <iostream>
using namespace std;
 
int main() {
    int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

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

int p[MAX];

int main()
{
	//素数
	fill(p, p + MAX, 1);
	for (int i = 2; i < MAX; i++){
		int sqrti = (int)sqrt(i);
		for (int j = 2; j <= sqrti; j++){
			if (i % j == 0){
				p[i] = 0;
				break;
			}
		}
	}

	int a, b;
	while (cin >> a >> b){
		int gcm = 1;
		bool flag = true;
		while (flag){
			for (int i = 2;; i++){
				if (p[i] == 1 && a % i == 0 && b % i == 0){
					gcm = gcm * i;
					a = a / i;
					b = b / i;
					break;
				}
				if (i == min(a, b)){
					flag = false;
					break;
				}
			}
		}
		int lcm = gcm * a * b;
		cout << gcm << " " << lcm << endl;
	}
	return 0;
}

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

int main() {
	int a, b, gcd, lcm;
	while (cin >> a >> b) {
		for (gcd = a;a%gcd != 0 || b%gcd != 0;gcd--);
		lcm = (a / gcd)*b;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

typedef long long ll;

ll a, b;

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

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

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

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
    int a, b;
    while (scanf("%d%d", &a, &b) != EOF) {
        const int g = gcd(a, b);
        printf("%d %d\n", g, a/g*b);
    }
    return 0;
}

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

typedef long long ll;

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

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

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/g;
cout<<x<<" "<<L<<endl;
x=0;y=0;
  ++i;
  if(i==49){break;}
}
  return 0;
}

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

long long GCD (long long a, long long b)
{
    long long t;
    if (a>b) swap(a,b);
    while (1)
    {
        t=b%a;
        if (t==0) break;
        b=a;
        a=t;
    }
    return a;
}

int main()
{
    long long a,b,gcd[50],lcm[50],c=0;
    while (cin>>a>>b)
    {
        gcd[c]=GCD(a,b);
        lcm[c]=a*b/gcd[c];
        c++;
    }
    for (int i=0; i<c; i++) cout<<gcd[i]<<" "<<lcm[i]<<'\n';
    return 0;
}