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 <string>
#include <sstream>
#include <vector>

//typedef struct
//{
//    int left_val;
//    int right_val;
//};

class GcdAndLcm
{
public:
    GcdAndLcm() : m_gcd(0), m_lcm(0) {}
    void Run();

private:
    void readData();
    void GetData(std::string s, int& v1, int& v2);
    int calcGcd(int m, int n);
    int calcLcm(int m, int n);
    void Show();

private:
    std::vector<std::string> m_data;
    unsigned int m_gcd;
    unsigned int m_lcm;
};

void GcdAndLcm::Run()
{
    int val1 = 0, val2 = 0;

    readData();
    
    for (unsigned int i = 0; i < m_data.size(); ++i) {
        GetData(m_data[i], val1, val2);
        m_gcd = calcGcd(val1, val2);
        m_lcm = calcLcm(val1, val2);
        Show();
    }
}
void GcdAndLcm::readData()
{
    std::string line;

    while (std::getline(std::cin, line)) {
        m_data.push_back(line);
    }
}

void GcdAndLcm::GetData(std::string s, int& v1, int& v2)
{
    size_t pos = s.find(" ");
    char tmp[100] = { 0 };
    std::strncpy(tmp, s.c_str(), pos);
    v1 = std::atoi(tmp);
    std::memset(tmp, 0x00, sizeof(tmp));
    pos++;
    std::strncpy(tmp, s.c_str() + pos, s.size() - pos);
    v2 = std::atoi(tmp);
}
int GcdAndLcm::calcGcd(int m, int n)
{
    if ((0 == m) || (0 == n))
        return 0;

    while (m != n)
    {
        if (m > n) m = m - n;
        else         n = n - m;
    }
    return m;
}//gcd

int GcdAndLcm::calcLcm(int m, int n)
{
    if ((0 == m) || (0 == n))
        return 0;

    return ((m / calcGcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

void GcdAndLcm::Show()
{
    std::cout << m_gcd << " " << m_lcm << std::endl;
}

int main()
{
    GcdAndLcm gcdAndLcm;

    gcdAndLcm.Run();
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b;

ll gcd(ll s, ll t){
    if(t == 0)  return s;
    return gcd(t, s%t);
}

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

void solve(){
    cout << gcd(a, b) << " " << prime_factor() << endl;

}

int main(){
    while (cin >> a >> b, cin.eof() != true){
    if(b>a) swap(a, b);
    solve();
    }
    
    return 0;
}

C++: #include <iostream>
int main(){
int a,b,n,i,j;
std::cin>>a>>b;
for(i=1;i<=a||i<=b;++i){
    if(a%i==0 && b%i==0){
    n=i* a/i* b/i;
    j=i;
    }
     }
     std::cout<<j<<" "<<n<<std::endl;
     return 0;
      }

C++: #include <stdio.h>

int main(void){
	int x, y;
	int tx, ty;
	int gcd, lcm;

	while(scanf("%d %d", &x, &y) != EOF){
		tx = x;
		ty = y;
		int r;

		while((r = x % y) != 0){
			x = y;
			y = r;
		}

		gcd = y;
		lcm = tx /gcd * ty;

		printf("%d %d\n", gcd, lcm);
	}

	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
#include<vector>
using namespace std;
long long gcd(long long a,long long b)
{
    if(b==0)
		return a;
    else return gcd(b,a%b);
}
int main()
{
    long long a,b;
    while(scanf("%I64d%I64d",&a,&b)!=EOF)
	{
		printf("%I64d %I64d\n",gcd(a,b),a/gcd(a,b)*b);
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int  i,a,b,c;
    while(cin>>a>>b){
        if(a==b){
            cout<<a<<" "<<a<<endl;
        }
        else{
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( int j=i;j>0;){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
        i=i-2;
    }
    cout<<c<<" "<<a*b/c<<endl;
        }
    }
    return 0;
}

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

template<typename T>
T gcd(T a, T b) {
	while (a != 0) {
		if (a < b) { //to be a > b
			std::swap(a, b);
		}
		a = a % b;
	}
	return b;
}
template<typename T>
T lcm(const T& a, const T& b) {
	return a * b / gcd(a, b);
}

int main(int argc, char const* argv[])
{
	unsigned long a{}, b{};
	while (std::cin >> a >> b) {
		std::cout << gcd(a, b) << ' ';
		std::cout << lcm(a, b) << std::endl;
	}
	return 0;
}

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(MIN(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)
{
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}


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



int main(){

int a,b;

while(cin >> a >> b){
    if(a == -1 or b == -1)  break;
   while(a <= 0 or b <= 0){
       cin >> a >> b;
   }
   if(a > 0 and b > 0){
        cout << gcd(a,b) << " "<< lcm(a,b)<< "\n";
    }
}

return 0;
}

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

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

int gcd(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 lcm(int a,int b){
	int max_common = gcd(a,b);
	return (a/max_common)*b;
}

int main(){
    long long a, b;

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

    return 0;
}

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

typedef long long LL;

LL GCD(LL a, LL b){
	if (a<b) std::swap(a, b);
	LL lcm = a * b; 
	while (b != 0)  { 
		LL gcd = a % b; 
		a = b; 
		b = gcd; 
	} 
	return a;
}

int main(){
	LL a, b;
	while (~scanf("%lld%lld", &a, &b)){
		LL tmp = GCD(a, b);
		printf("%lld %lld\n", tmp, a*b/tmp);
	}
	return 0;
}

C++: #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)
{
  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>
#include <cstdio>
#include <cstdlib>

using namespace std;


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

int main()
{
	long a, b, d;

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

C++: #include<iostream>
using namespace std;
int main(){
  long long  a,b;
  while(cin>>a>>b){
    //Eucledean algorithm                                                                                                     
    long long c,d,r,GCD,LCM;
    c=a;d=b;
    do{
      r=c%d;
      c=d;d=r;
    }while(r);
    GCD=c;
    LCM=a*b/GCD;
    cout << GCD << ' ' << LCM <<endl;
  }
  return 0;
}

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=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    }
    return 0;
}