Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int lcm(int x,int y){
	return ((x/gcd(x,y))*y); 
}
int main(){
	int a,b;
	while(1){
		std::cin>>a>>b;
		if(std::cin.eof())break;
		std::cout<<gcd(a,b)<<" "<<lcm(a,b)<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int a,b,lcm=0,r,x,y;
    while(cin>>a>>b){
        x=a;
        y=b;
        while(1){
        r=a%b;
        a=b;
        b=r;
        if(r==0)break;
        }
        lcm=a;
    cout<<lcm<<" "<<x*y/lcm<<endl;
}
}

C++: #include<iostream>
using namespace std;
int main(){
int a,aaa,bbb, b, aa[100], bb[100], r,kazu,m;
kazu = 0;
while (cin >> aaa >> bbb) {
	kazu++;
	m = aaa * bbb;
	a = aaa;
	b = bbb;
	if (a <= b) {
		r = a;
		a = b;
		b = r;
	}
	while (b != 0) {
		r = a % b;
		a = b;
		b = r;
	}
	aa[kazu] = a;
	if (m > 0) {
		bb[kazu] = m / aa[kazu];
	}
	else {
		m = aaa / aa[kazu];
		bb[kazu] = m * bbb;
	}
}
for (int i = 1; i <= kazu; i++) {
	cout << aa[i] << " " << bb[i] << endl;
}
}

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b;
    while (cin >>a >>b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

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

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

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

typedef long long ll;

void lc(ll a,ll b)
{
	ll m=a,n=b,c;  
    while(b!=0)  
    { 
    	c=a%b; 
		a=b; 
		b=c;
	} 
	printf("%lld %lld\n",a,m/a*n);
}
int main (void)
{
	ll a,b;
	while(scanf("%lld%ulld",&a,&b)!=EOF)
	    lc(a,b);
	return 0;
}

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

int saidai(long long int a,long long int b){
	while(b){
		int m=a%b;
		a=b;
		b=m;
	}
	
	return a;
}


int	saisyou( long long int a,long long int b ){
	return (a*b)/saidai(a,b);
}

int main(){
	long long int a,b;
	cin>>a;
	cin>>b;
	
	cout<<saidai(a,b)<<" "<<saisyou(a,b);;
	return 0;

}

C++: #include<iostream>


long long gcd (long long a, b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%ld", &a) != EOF) {
    scanf("%ld", &b);
    long long g = gcd(a, b);
    printf("%ld %.3lf\n", g, a * b / g);

  }

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
typedef long long ll;

using namespace std;

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

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

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

int main(){
	long a, b;
	while (cin >> a >> b){
		long c = a;
		long d = b;
		while (1){
			if (c < d) swap(c, d);
			// c >= d
			if (c % d == 0){
				cout << d << " " << (a * b) / d << endl;
				break;
			}
			else{
				long tmp = c;
				c = d;
				d = tmp % d;
			}
		}
	}
	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(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

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

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<stdio.h>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
	int  a, b, a1, b1, c, g;
	long l;
	cin >> a >> b;
	a1 = a;
	b1 = b;
	while (1)
	{
		if (a == 0 || b == 0)
		{
			break;
		}


		while (1)
		{
			c = abs(a - b);
			if (c == 0)
			{
				break;
			}

			if (a > b)
			{
				a = c;
				g = c;
			}
			else if (a < b)
			{
				b = c;
				g = c;
			}
		}
		l = (a1 / g)*b1;
		cout << g << " " << l<<endl;
		cin >> a >> b;
		a1 = a; b1 = b;
	}
}

C++: #include <iostream>

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		long int minmul; //least common multiple
		u_int maxdivi = 1; //greatest common divisor
		u_int small;

		if(a > b)
			small = b;
		else
			small = a;

		for(int i = 2; i <= small; ++i){
			if(a % i == 0  &&  b % i == 0){
				maxdivi = maxdivi * i;
				i = 2;
			}
		}
		minmul = a * b / maxdivi;

	std::cout << maxdivi << " " << minmul << std::endl;

	}

	return 0;
}

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

int main()
{
	long int a,b,i,min,max,x,y; //x最大公約数 y最小公倍数

	while(cin>>a>>b){
		x=y=0;
		if(a<b){
			min=a; max=b;
		}else{
			max=a; min=b;
		}

		for(i=min,x=0; x==0; i--){
			if(a%i==0 && b%i==0) x=i;
		}
		for(i=max,y=0; y==0; i++){
			if(i%a==0 && i%b==0) y=i;
		}

		cout<<x<<" "<<y<<endl;
	}
}

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(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

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

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

int main(){
		int a, b;
		while(cin >> a >> b){
				int gcd;
				vector<int> divisor_a;
				vector<int> divisor_b;
				for(int i = 2; i <= a; i++){
						if(a % i == 0) divisor_a.push_back(i);
				}
				for(int i = 2; i <= b; i++){
						if(b % i == 0) divisor_b.push_back(i);
				}
				for(int i = 0; i < divisor_a.size(); i++){
						for(int j = 0; j < divisor_b.size(); j++){
								if(divisor_a[i] == divisor_b[j]) gcd = divisor_a[i];
						}
				}
				cout << gcd << " " << a * b / gcd << endl;
		}
		return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

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

int main()
{
	lld a,b;
	while(cin >> a >> b)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld sol = gcd(m,n);
		cout << sol << endl;
		cout << n * m / sol << endl;
	}


	return 0;
}

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

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

int main(){
	int a, b;
	while(cin >> a >> b){
		while(!(((a > 0)&&(a <= 2000000000))&&((b > 0)&&(b <= 2000000000)))){
			cout << "wrong value\n";
			cin >> a >> b;
		}
		cout << gcd(a, b) << " " << lcm(a, b) << "\n";
	}
    return 0;
}

//Greatest Common Divisor
int gcd(int a, int b){
	while(a != b){
		if(a > b) a = a - b;
		else b = b - a;
	}
	return a;
}

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