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 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 "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main(){
    ll A,B;
    ll a,b;
    ll t1,t2;
    while( cin>>a>>b ){
        A=a;B=b;
        if(a<b)swap(a,b);
        while(1){
            t1=b;
            t2=a%b;
            a=t1,b=t2;
            if(b==0){
                cout<<a<<" "<<A*B/a<<endl;
                break;
            }
        }
    }
}

C++: #include <iostream>

#define ll long long

using namespace std;

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

 return x;
}

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 <cstdio>

using namespace std;

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

int main(){
    int a, b,gcd;
    long int lcm;
    while(true){
        scanf("%d%d",&a,&b);
        gcd = gcdr(a,b);
        //printf("%d\n",gcd);
        lcm = (long)a * b / gcd;
        printf("%d %ld\n",gcd,lcm);
    }
    
    return 0;
}

C++: #include<iostream>
int e(int a,int b){if(a<b)a^=b^=a^=b;return(a%=b)?e(b,a):b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",c,a*b/c))c=e(a,b);}

C++: #include<iostream>
using namespace std;
int main(){
  long int sn = 0;
  long int bn = 0;
  long int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0){
      lcm = i;
      break;
    }
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0){
      gcd = i;
      break;
    }
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

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

C++: #include<stdio.h>
int main(void)
{
    int  i,a,b,c,x,y;
	
	while(scanf("%d %d",&a,&b)!=EOF){
		x=a;	y=b;
		if(a<b){
			c=a;
			a=b;
			b=c;
		}
		c=a%b;
		while(c!=0){
			a=b;
			b=c;
			c=a%b;
		}
		i=x/b*y;
		printf("%d %d\n",b,i);
	}
	return 0;
}

C++: //
//  main.cpp
//  gcd
//
//  Created by Syngnath on 15/12/16.
//  Copyright ? 2015年 Syngnath. All rights reserved.
//
#include <iostream>
#include <cstdio>

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

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

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

C++: #include <cstdio>

#define INT unsigned long

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

INT lcm(INT a, INT b)
{
  INT tmp = gcd(a, b);
  /* gcd(a, b) * lcm(a, b) = a * b */
  return tmp ? a * b / tmp : 0;
}

int main(void)
{
  INT a, b;
  
  while (std::scanf("%ld %ld\n", &a, &b) != EOF) {
    std::printf("%ld %ld\n", gcd(a, b), lcm(a, b));
  }

  return 0;
}

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

int euclid_alg(const int a, const int b) {
	return a % b;
}

int main(void) {
	int a,b;
	std::vector<int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}
	
	for(int i = 0; i < num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] == 0 || num[i+1] == 0){
			if(a > b){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i+1],num[i]);
			}
		}
		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

C++: 
#include<iostream>
#include <xiosbase>
using namespace std;
long long gcd(long long a,long long b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
long long kmm(long long a,long long b)
{
    return a*b/gcd(a,b);
}
int main()
{
	system("CLS");
    long long a,b;
    cin>>a>>b;
	while(!cin.eof())
	{
	cout<<gcd(a,b);
	cout<<" ";
	cout<<kmm(a,b);
	cout<<endl;
	cin>>a>>b;

	}
    return 0;
}

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

using namespace std;

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

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

int a, b;
int main(){
    while(cin>> a>> b){
        if(a<b) swap(a, b);
        printf("%d %lld\n", gcd(a, b), lcm(a, b));
    }
}

C++: #include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


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

  return 0;
}

C++: #include<iostream>
#define max(a,b) a>b ? a : b
#define min(a,b) a<b ? a : b
using namespace std;

typedef long long ll;

ll LCM(ll a, ll b)
{
	ll result;
	ll n1 = max(a, b);
	ll n2 = min(a, b);
	for (int i = 1;; i++)
	{
		result = n1*i;
		if (result%n2 == 0)
			return result;
	}
}

ll GCD(ll a, ll b)
{
	while (true)
	{
		int ma = max(a, b), mi = min(a, b);
		if (ma%mi == 0)
			return mi;
		else
		{
			ma -= mi;
			return GCD(ma, mi);
		}
	}
}

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

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

int main() {
	
	int a,b,m,g;
	
	while(cin>>a>>b){
		if(a>b)m=a; else m=b;
		for(int i=m;i>0;i--){
			if(a%i==0&&b%i==0){
				g=i;
				break;
			}
		}
		cout<<g<<" "<<a/g*b<<endl;
	}
	
	return 0;
}

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

using namespace std;

long long a, b;

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

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

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

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

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

C++: #include <stdio.h>
int main(void){
    long long a, b, c, d, tmp;
        scanf("%d %d", &a, &b);
     d = a * b;
    if(a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
     c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
        printf("%d %d\n", b, d / b);
            return 0;
}