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>
#include<vector>
using namespace std;
#define DBG cout<<"!"<<endl;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    les=b%bet;
    if(les==0)
      max=bet;
    else{
    for(int i=1;i<=bet;i++){
      if(bet%i==0)
	ayaku.push_back(i);
    }
    for(int i=1;i<=les;i++){
      if(les%i==0)
	byaku.push_back(i);
    }
    for(int i=0;i<ayaku.size();i++){
      for(int j=0;j<byaku.size();j++){
	if(ayaku[i]==byaku[j]&&ayaku[i]>max)
	  max=ayaku[i];
      }
    }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}

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

int main(){
	long long a,b,GCD,LCM,x,a2,b2;

	cin>>a>>b;
	a2=a;
	b2=b;
	while(a!=b){
		if(a>b){
			x=a-b;
			a=b;
			b=x;
		}
		else if(b>a){
			x=b-a;
			b=a;
			a=x;
		}
	}
	GCD=a;
	LCM=a2*b2/a;

	cout<<GCD<<" "<<LCM<<endl;

	return 0;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

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

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
        if(a<0 || a>2000000000 || b<0 || b>2000000000)
        {
            return 0;
        }
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    }

}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#define esp 1e-8
using namespace std;
typedef long long ll;
int n,k;
double a[10005];
bool F(double mid)
{
    int ans=0;
    for(int i=0;i<n;i++)
    {
        ans+=a[i]/mid;
    }
    return ans>=k;
}
int main()
{
    ll a,b;while(cin>>a>>b)
    {
        ll gcd=__gcd(a,b);
        ll lcm=a*b/gcd;
        cout<<gcd<<" "<<lcm<<endl;
    }
}

C++: #include <bits/stdc++.h>
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, g;
    while(cin >> a >> b){
        g=gcd(a, b); 
        cout << g << " " << a*b/g <<  endl;
    }
}
//g++ -o proa.exe proa.cpp

//VSCなら./test
//Atomならtest.exe

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	long long int a,b,ans;
	while(cin>>a>>b){
		for(int i=2;i<=(min(a,b));i++){
			if(a%i==0 && b%i==0)ans=i;
		}
		cout<<ans<<ans*(a/ans)*(b/ans)<<endl;
	}
    return 0;
}

C++: /*
*AOJ0005 GCD and LCM
**問題
[http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005&lang=jp]
*/
#include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

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

int main() {
  // ifstream cin("../test.txt");
  int a, b, g;
  long long l;
  while (cin >> a >> b) {
    g = gcd(a, b);
    l = a * b / g;
    cout << g << " " << l << endl;
  }
}

C++: #include <iostream>

using namespace std;

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

  if (a > b) return a;
  return b;
}

int main(void)
{
  int a, b;

  while (cin >> a >> b) {
    int gcd = getGcd(a, b);
    printf("%d %d\n", gcd, a * (b / gcd));
  }

  return 0;
}

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

void compare(long int* a, long int* b){
  long int tem;
  if(*a < *b){
    tem = *a;
    *a = *b;
    *b = tem;
  }
}


int main(){
  long int a, b, k;
  long int x[1000][2];
  int n = 0;


  while(cin >> a >> b){
    k = a * b;
    while(1){
      if(a == b)
        break;
      compare(&a, &b);
      a = a - b;
    }
    x[n][0] = a;
    x[n][1] = k / a;
    n++;
  }

  for(int i = 0; i < n; i++)
    cout << x[i][0] << " " << x[i][1] << '\n';

  return 0;
}

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

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

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

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

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

long long gcd(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a == b) ? a : gcd(b % a, a);
}

long long lcm(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a / gcd(a, b)) * b;
}

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

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// GCD show
		std::cout << b << std::endl;
		
		// LCM
		long int lcm = product / b;

		//LCM show
		std::cout << lcm << std::endl;
	}
	
	return 0;
}

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

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){
		int tmp=a;
		a=b;
		b=tmp-b;
		if(a<b){
		b=1;
		break;
		}
		if(a-b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

long long gcd(long long a, long long b){ // Ååöñ
    if(a == 0 || b == 0)
        return 0;
    if(b > a)
        swap(a, b);
    long long tmp;
    while((tmp = a % b) != 0){
        a = b;
        b = tmp;
    }
    return b;
}

long long lcm(long long a, long long b){ // Å¬ö{
    return a / gcd(a, b) * b;
}

int main()
{
    for(;;){
        long long a, b;
        if(!(cin >> a >> b))
            return 0;
        cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
    }
}