Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			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>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(i=15000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
                break;
        }
    }
        f=a*b/i;
        if(a==b){
            f=(a*b)/(a*b);
        }
        cout<<i<<" "<<f<<endl;
    }
    return 0;
}

C++: #include<stdio.h>

int main(void)
{
	int a[2],b[2],x,m,n,t;
	scanf("%d %d",&a[0],&b[0]);
	scanf("%d %d",&a[1],&b[1]);

	for(x=0;x<2;x++)
	{
		if(a[x]>b[x])
		{
			m=a[x];
			n=b[x];
		}
		else
		{
			m=b[x];
			n=a[x];
		}

		while(n!=0)
		{
			t=n;
			n=m%n;
			m=t;
		}
		
		t=a[x]*b[x]/m;
		printf("%d %d\n",m,t);
	}
}

C++: #include<cstdio>

using namespace std;

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

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

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll GCD(ll a, ll b) {
    return a == 0 ? b : GCD(b%a, a);
} 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a, b, gcd, lcm;
    while (cin >> a >> b) {
        gcd = GCD(a, b);
        lcm = a * b / gcd;
        cout << gcd << " " << lcm << "\n";
    }

    return 0;
}

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

int gcd(int u, int v)
{
  int r;

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b, z;

  while(scanf("%d %d", &a, &b))
  {
    if(b > a)
    {
      z = a;
      a = b;
      b = z;
    }
      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }

  return 0;
}

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

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

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

C++: #include <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
   lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(1){
    if(a==1) return b;
    else     return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

int l(int a, int b){
  int i = 2;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}

C++: #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

using namespace std;

long long gcd(long long n1, long long n2)
{
    if(n1<n2) gcd(n2,n1);
    else if(n2==0) return n1;
    else
    {
        return gcd(n2,n1%n2);
    }
}

int main()
{
    long long mGCD,mLCM;
    long long n1,n2;
    while(cin>>n1>>n2)
    {
        mGCD=gcd(n1,n2);
        mLCM=(n1/mGCD)*n2;
        cout<<mGCD<<" "<<mLCM<<endl;
    }

    return 0;
}

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

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

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

int main()
{
	int a[2];
	int i=0;
	int n1,n2;
	while(cin >> n1 && cin >> n2){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		cout << gcm(n1,n2) << ' ' << lcm(n1,n2) << endl;
	}
	
	return 0;
}

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

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(~scanf("%d%d", &a, &b))
    {
        int a1 = max(a, b);
        int b1 = min(a, b);
        int ans1 = gcd(a1, b1);
        long long  ans2 = a / ans1 * b;
        cout<<ans1<<" "<<ans2<<endl;
    }

    return 0;

}

C++: #include<iostream>

//最大公約数を求めるプログラム(m >= n)
int calcGcd(int m, int n);
//最小公倍数を求めるプログラム
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, x, y;
	
	while(std::cin >> x >> y){
		if(x > y) gcd = calcGcd(x, y);
		else gcd = calcGcd(y, x);
		lcm = calcLcm(x, y, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
}

int calcGcd(int m, int n){
	if(n == 0) return m;
	else return calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m * n / gcd;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		if(b==0)break;
		int tmp=a;
		a=b;
		b=tmp%b;
		if(a%b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int gcd(int m,int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

int main()
{
	int a, b;
	while (cin >> a >> b) {
		if (a >= b)
			cout << gcd(a, b) << endl;
		else
			cout << gcd(b, a) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a,b,c,rest;
	while(cin >>a>>b){
		int a2=a,b2=b;
		if(a>b){c=a;a=b;b=c;}
		while((rest=b%a)!=0){
			b=a;
			a=rest;
		}
		cout <<a <<" "<<a2/a*b2 << endl;
	}
	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;
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
        if(cin.eof()){break;}
    }
}

int gcd(int a,int b){
    int n;
    for (int i=1;i<a;i++){
        if (a%i==0 && b%i==0)
            n = i;
    }
    return n;
}

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

C++: #include <iostream>

#define CASE double

using namespace std;

int GCD(CASE x, CASE y)
{
	if (x == 0 || y == 0)
		return x + y;
	else
	{
		if (x >= y)
		{
			x = x - y;
			GCD(x, y);
		}
		else
		{
			y = y - x;
			GCD(x, y);
		}
	}
}

int main(){
	CASE a, b;
	unsigned long int d, l;
	while (1){
		cin >> a;
		cin >> b;
		d = (unsigned long int)GCD(a, b);
		l = a * b / d;
		cout << d << " " << l << endl;
	}
	return 0;
}

C++: #include <iostream>


using namespace std;

int main(){
	int a;
	int b;
	int ii = 1;
	cin >> a >> b;
	for (int i = 0; i <= 2000000000; i++){
		int c = ii / a * a;
		int d = ii / b * b;
		if (ii == c&&ii == d){
			cout << ii <<  " " <<a * b / ii<< endl;
			break;
		}
		else ii++;

	}

	return 0;
}

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

int LCM(int a, int b) {
	int result = 1;
	int i = 2;
	while(i <= a && i <= b) {
		if (a % i == 0 && b % i == 0) {
			result *= i;
			a /= i;
			b /= i;
		}
		else i++;
	}
	return result;
}

int GCD(int a, int b) {
	int result = 1;

	int lcm = LCM(a, b);

	a /= lcm;
	b /= lcm;

	return a * b*lcm;


}

int main() {
	int a, b, lcd;

	while (cin >> a >> b) {




		printf("%d %d\n", LCM(a, b),GCD(a,b));

	}

	//system("pause");
	return 0;
}

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