Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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

long long gcd(long long  a,long long b)
{
	if(b==0)
		return a;
	else
		return gcd(b,a%b);
}
int main()
{
	long long  n, m;
	while(scanf("%ld %ld",&n,&m)!=EOF)
	{
		long long  tmp,tnp;
		if(n>m)
		{
			tmp=n;
			tnp=m;
		}
		else
		{
			tmp=m;
			tnp=n;
		}
		printf("%ld %ld\n",gcd(tmp,tnp),n/gcd(tmp,tnp)*m);
	}
	return 0;
}

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

using namespace std;

int max(int x, int y){
        int r;

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

int small(int x, int y, int r){
        if(x * y % r  == 0)
                return x * y / r;
        else
                return x * y;
}       

int main(){
        int x,y,r;

        while((scanf("%d %d",&x,&y)) != EOF){
                if(x < y){
                        int num = y;
                        y = x;
                        x = num;
                }
                cout << max(x,y) << " " << small(x,y,max(x,y)) << endl;
        }
}

C++: #include<iostream>

int main(){
	int x,y;
	std::cin>>x>>y;
	
	for(int j=x;j>0;--j){
		if(x%j==0&&y%j==0){
			std::cout<<j<<' ';
			break;
		}
	}

	for(int i=x;i>0;++i){
		if(i%x==0&&i%y==0){
			std::cout<<i<<std::endl;
			break;
		}
	}

	return 0;
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i >= 1; i--){
		if (a % i == 0)
			if( b % i == 0)
				break;
	}
	return i;
}


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

C++: #include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;


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

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

C++: #include<cstdio>
#include<iostream>
int main()
{ int a,b,p,i;
 while(scanf("%d%d",&a,&b)!=EOF)
 {int i;
  if(a>b)p=a,a=b,b=p;
  for(i=a;i>=1;i--)
  if(a%i==0&&b%i==0){printf("%d ",i);break;}
  a=a/i;b=b/i;
  printf("%d\n",a*b*i);
 }
 return 0;}

C++: #include <iostream>
#define SWAP(a,b) (a ^= b,b = a ^ b,a ^= b)

typedef unsigned int uint;
typedef long long ll; 
using namespace std;

uint solve(uint a, uint b) {
  if (a % b == 0) return b;
  else solve(b, a % b); 
}

int main() {
  uint  a, b, r;
  while (cin >> a >> b) {
    if (a < b) SWAP(a, b); 
    r = solve(a, b); 
    cout << r << " " << (ll)a * (ll)b / r << endl;
  }
  return 0;
}

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

int main(){
   int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      if(a<b){
         tmp=a;
         a=b;
         b=tmp;
      }
      while(1){
         if(a%b==0){
            m=b;
            break;
         }
         else{
            a=a-b;
            tmp=a;
            a=b;
            b=tmp;
         }
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

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

int lcm(int a, int b);
int gcd(int a, int b);

int main(void){
    int n, m;
    while(cin >> n >> m){
        cout << gcd(n, m) << " " << lcm(n, m) << endl;
    }
}

int lcm(int a, int b){
    int sum_a = a;
    int sum_b = b;
    while(true){
        if(sum_a < sum_b){
            sum_a += a;
        } else if(sum_a > sum_b){
            sum_b += b;
        } else {
            return sum_a;
        }
    }
}

int gcd(int a, int b){
    int smaller = a < b ? a : b;
    int bigger = a > b ? a : b;
    int end_point = smaller / 2 + 1;
    int counter = 0;
    int answer = 0;
    while(counter <= end_point){
        counter++;
        if(a % counter == 0 && b % counter == 0){
            answer = counter;
        }
    }
    if(bigger % smaller == 0){                                    
        answer = smaller;                                         
    } 
    return answer;
}

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

LL GCD(LL a,LL b){ // a>=b とする
	if(a%b) return GCD(b,a%b);
	return b;
}

int main(){
	LL a,b;
	while(cin>>a>>b){
		LL gcd=GCD(max(a,b),min(a,b));
		cout<<gcd<<" "<<a*b/gcd<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

int GetGCD(int x, int y);

int main(void){
    int n,m,gcd,lcm;
    
    while (scanf("%d %d", &n, &m)!=EOF){
        gcd = GetGCD(n,m);
        lcm = n * m / gcd;
        printf("%d %d\n", gcd, lcm);
    }
    return 0;
}

int GetGCD(int x, int y){
    return y%x ? GetGCD(y%x, x) : x;
}

C++: #include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<ll, int> ll_i;
struct edge { int u, v; ll w; };

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

int main() {
	while (cin) {
		ll a, b; cin >> a >> b;
		ll x = gcd(a, b);
		cout << x << " " << a * b / x << endl;
	}
}

C++: #include <iostream>
#include<cstdio>
using namespace std;
long long a,b;
long long  gcd(long long m,long long n){
    if(m<n){
        long long p=n;
        m=n;
        n=p;
    }
    while(n!=0){
        long long  p=m%n;
        m=n;
        n=p;
    }
    return m;
}
long long  lcd(long long  m,long long  n){
    return m*(n/gcd(m,n));
}
int main()
{
    while(scanf(" %d %d",&a,&b)!=EOF){
        cout<<gcd(a,b)<<lcd(a,b);
    }
}

C++: #include <iostream>

using namespace std;

int gcd(int x, int y){
    if (y == 0){
        return x;
    }else{
        return gcd(y, x % y);
    }
}

int main()
{

    int a, b, g, l;
    while (cin >> a >> b) {
        g = gcd(a, b);
        l = a / g * b;
        cout << g << ' ' << l << endl;
    }
    return 0;
}