Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d\n", G, L)
	}
}

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

int GCD(int x,int y) {
    if (x<y) {
        swap(x,y);
    }
    if (y==0) {
        return x;
    }
    return GCD(y,x%y);
}
int LCM(int x,int y) {
    return x/GCD(x,y)*y;
}
int main() {
    int a, b;
    while (cin >> a >> b) {
        printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
    return 0;
}

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

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

 GCD(b, a%b);
}

int LCM(int a, int b)
{
 int c = GCD(a, b);

 return a*b/c;
}

int main()
{
 int a, b;

 while( cin >> a >> b){
  cout << GCD(a, b) << ' ' << LCM(a, b) << '\n';
 }

 return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <numeric>
#include <algorithm>
#include <cmath>

using namespace std;

inline long int gcd(long int a, long int b)
{
	if ((0 == a) || (0 == b)) return 0;
	while (a != b)
	{
		if (a > b) a = a - b;
		else  b = b - a;
	}
	return a;
}

inline long int lcm(long int a, long int b)
{
	if ((0 == a) || (0 == b)) return 0;
	return ((a / gcd(a, b)) * b);
}

int main(void)
{

	long int a, b;
	long int x, y;

	while (cin >> a >> b)
	{
		x = gcd(a, b);
		y = lcm(a, b);

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

}

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

using namespace std;

typedef long long int ll;

ll GCD(ll x, ll y)
{
    return !y ? x : GCD(y, x % y);
}

ll LCM(ll x, ll y)
{
    return x * y / GCD(x, y);
}

int main()
{
    ll a, b;
    while (cin >> a >> b)
    {
        cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(){

long long int a,b,A,B;

while(cin>>a>>b){
 A=a;B=b;
 while (b)
      {
	int tmp = a % b;
	a = b;
	b = tmp;
      }

b=A*B/a
cout<<a<<" "<<b<<endl;
}
return 0;
}

C++: #include <iostream>
using namespace std;
long long int gcd(int a,int b)
{
    return b==0?a:gcd(b,a%b);
}
int main()
{
    long long int a,b,g,l;
    while(cin>>a>>b)
    {
        long long int temp;
        if(a<b)
            {
                temp=a;
                a=b;
                b=temp;
            }
            g=gcd(a,b);
            l=a*b/g;
            cout<<g<<" "<<l<<endl;
    }
    return 0;
}

C++: #include <iostream>

int  main() {
	long long  a = 0, b = 0, ad = 0, bd = 0, swap, amari, koba = 0;
	std::cin >> a >> b;
	ad = a; bd = b;
	if (b >= a) { swap = a; a = b; b = swap; }
		
	a:
		amari = a%b;
		if (amari == 0) {
			std::cout << b << " ";
			std::cout << ad*bd / b << std::endl;
		}
		else {
			a = b;
			b = amari;
			goto a;
		}
}

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

int main() {
	for(long long a, b; scanf("%lld %lld", &a, &b) == 2;) {
		long long g = __gcd(a, b);
		printf("%lld %lld\n", g, a / g * b);
	}

	return EXIT_SUCCESS;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
long gcd(long a, long b) {
  return a % b ? gcd(b, a % b) : b;
}
 
void solve(long a, long b) {
  int c = gcd(a, b);
  cout << c << " " << a / c * b << endl;
}
 
int main() {
  long a, b;
  while (cin >> a >> b) solve(a, b);
}

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

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

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

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

using namespace std;

int main()
{
	int m,n;
	
	while(scanf("%d %d", &m, &n) != EOF){
		if(n > m) swap(m, n);
		
		int x = m;
		int y = n;
		
		while(n != 0){
			int tmp = n;
			n = m%n;
			m = tmp;
		}
		
		printf("%d %d\n", m, x/m*y);
	}
	
	return(0);
}

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

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int main() {
	vector<int>a(2);
	cin >> a[0] >> a[1];
	sort(a.begin(), a.end());
	int b = gcd(a[1], a[0]);
	cout << b << " " << a[1] * a[0] / b << endl;
}

C++: #include <iostream>

using namespace std;

long gcd(long a, long b)
{
  long m, n;
  if (a > b) {
    m = a;
    n = b;
  } else {
    m = b;
    n = a;
  }

  long tmp;
  while (n != 0) {
    tmp = n;
    n = m % n;
    m = tmp;
  }

  return m;
}

long lcm(long a, long b, long _gcd = -1)
{
  if (_gcd == -1) {
    _gcd = gcd(a, b);
  }
  
  return a * (b / _gcd);
}

int main(int argc, char const* argv[])
{
  long a, b, _gcd, _lcd;
  while (cin >> a >> b) {
    _gcd = gcd(a, b);
    _lcd = lcm(a, b, _gcd);
    cout << _gcd << " " << _lcd << endl;
  }
  return 0;
}

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


 int euclid(long long int a, long long int b){
  if (b < a) {
    long long int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  long long int a,b;
  while(scanf("%d %d",&a,&b)!=EOF){
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b))<<endl;
}
}

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

long long int GCD(long long int a, long long int b) {
    return (b % a == b) ? a : GCD(b % a, a);
}

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

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

C++: #include <iostream>

using namespace std;
int firstNumber,secondNumber;

int GCD(int x, int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        if(y<x)
        {
            x = x-y;
        }
    }
    return x;
}

int LCM(int x, int y)
{
    return x*y / GCD(x,y);
}



int main()
{   while(cin >> firstNumber >> secondNumber)
    {
        cout << GCD(firstNumber,secondNumber) << " " << LCM(firstNumber,secondNumber) << endl;
    }

}

C++: // 2015/05/19 Tazoe

#include <iostream>
using namespace std;

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

	return gcd(b, a%b);
}

int main()
{
	while(true){
		int a, b;
		cin >> a >> b;

		if(cin.eof())
			break;

		int g = gcd(a, b);

		cout << g << ' ' << a/g*b << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
 int a,b;
 while(cin>>a>>b){
  int oa=a,ob=b;
  while(b!=0)
  {
   int r=a%b;
   a=b;
   b=r;
  }
  cout<<a<<" "<<(oa/a*ob)<<endl;
 }
}

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

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

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

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 main(void){
  int i,a,b,temp,r,lcm;

  while(cin >> a >> b){
    if(a<b){
      temp=a;
      a=b;
      b=temp;
    }

    int x=a,y=b;

    while(b>0){
      r=a%b;
      a=b;
      b=r;
    }

    lcm=x*(y/a);
    printf("%d %d\n",a,lcm);
  }

  return 0;
}