Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <iostream>

using namespace std;

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

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

C++: #include<bits/stdc++.h>
/*
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
*/
using namespace std;

typedef long long ll;

#define sqr(x) (x)*(x)
#define pb push_back
#define fst first
#define snd second

const ll mod=1000000007;
const int maxn=100005,maxm=505;
const double eps=1e-9;
const double pi=acos(-1.0);

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

ll a,b;

int main()
{
	int i,j,T;
	while(scanf("%lld %lld",&a,&b)!=EOF)
	{
		ll g=gcd(a,b);
		printf("%lld %lld\n",g,a/g*b);
	}
	return 0;
}

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

using namespace std;
int main()
{
	int  a, b,a1,b1,c,c1,g,l;
	cin >> a;
	cin >> b;
	a1 = a;
	b1 = b;
	
	while (1)
	{
		c1 =c ;
		c = abs(a - b);
		if (c==0)
		{
			break;
		}
		
		if (a > b)
		{
			a = c;
			
			c1 = b + c;
		}
		else if (a<b)
		{
			
			b = c;
			
		}
	}
	g = c1;
	l = a1*b1 / g;
	cout << l << " " << g;

	
}

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;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}

C++: #include <iostream>
using namespace std;
long long a1,a2;
long long gcd,lcm;

long long GCD(long long a,long long b){
    long long i = 2;
    long long minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (i = 1; i <= minimum; i++) {
            if (a % (minimum - i + 1) == 0 & b % (minimum - i + 1) == 0) {
                i = minimum - i + 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
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 ans = gcd(a,b);
  ll ans2 = a * b / ans;
  cout << ans << " " << ans2 << endl;
  }
  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 main() {
  for(int a, b; cin >> a >> b; ) {
    int g = gcd(a,b);
    cout << g << " " << a / g * b << endl;
  }
}

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

int main(){
	int a,b,gcd,lcm;
	while(cin >> a >> b){
		int c=a,d=b;
		lcm=gcd=1;
		for(int i = 2; i < c || i < d;){
			if(c%i==0&&d%i==0){
				c/=i;
				d/=i;
				lcm=gcd*=i;
			}else i++;
		}
		lcm*=c*d;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

void calcGCDLCM(unsigned int in1, unsigned int in2,
    unsigned int* GCD, unsigned int* LCM) {
  unsigned int num1, num2;
  unsigned int denom=2;
  unsigned int tempGCD=1;

  if(in1>in2) {
    num1=in2;
    num2=in1;
  } else {
    num1=in1;
    num2=in2;
  }

  while(denom <= num1) {
    if(num1 % denom == 0 && num2 % denom == 0) {
      tempGCD *= denom;
      num1 /= denom;
      num2 /= denom;
    } else {
      denom++;
    }
  }

  *GCD = tempGCD;
  *LCM = tempGCD*num1*num2;
}

int main() {
  unsigned int in1, in2;
  unsigned int GCD, LCM;

  while(cin >> in1 >> in2) {
    calcGCDLCM(in1,in2,&GCD,&LCM);
    cout << GCD << " " << LCM << endl;
  }
  return 0;
}

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

int main() {
  int p, q;
  int a, b, c;
  int lcm, gcd;

  while (1) {
    cin >> p >> q;
    if (cin.eof()) break;
    if (p > q) {
      a = p;
      b = q;
    } else {
      b = p;
      a = q;
    }

    while(a%b) {
      c = a-b;
      a = b;
      b = c;
    }
    lcm = b;
    gcd = p/lcm*q;
    cout << lcm << " " << gcd << endl;
  }
  return 0;
}

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

using namespace std;
#define lli unsigned long long int

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


int main(){
  lli a,b;
  while(~scanf("%lld%lld",&a,&b)){
          
    lli tmp1=gcd(a,b);
    lli tmp2=a*b/tmp1;
    printf("%lld %lld\n",tmp1,tmp2);

  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((double)m/a);
        cout << g << " " << a << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d", 0, 0);
    } else {
      printf("%d %d", a * b / m, m);
    }
  }
  return 0;
}

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

long long int GCD_Num(long long int a, long long int b)      //最大公约数
{
    long long int MAX=max(a,b);
    long long int MIN=min(a,b);
    long long int op;
    while(MAX%MIN!=0){
        op=MAX%MIN;
        MAX=MIN;
        MIN=op;
    }
    //cout<<MIN;
    return MIN;
}

void LCM_Num(long long int a, long long int b)
{
    long long int temp_lcm;
    temp_lcm=(a*b)/GCD_Num(a,b);
    cout<<GCD_Num(a,b)<<" "<<temp_lcm<<endl;
}

int main()
{
    long long int a,b;
    while(cin>>a>>b){
        GCD_Num(a,b);
        LCM_Num(a,b);
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <iterator>
#include <limits>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#define endl '\n'
#define INF (214748347/2)
#define LL long long
#define PII pair<int, int>
using namespace std;
const int MAXN = 40;

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int a, b;
    while (cin >> a >> b) {
        int g = gcd(a, b);
        cout << g << " " << a / g * b << "\n";
    }
}