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 <iostream> 
#include<string.h>
#include<stdio.h>
using namespace std;
long long cc( long  long  q, long long  p)
{

	if(q%p==0)
	{
		return p;
	}
	else
	return cc(p,q%p);
}
main()
{
	long long x,y,a[1000],b[1000];
	int i=0;
	while(scanf("%lld%lld",&x,&y)!=EOF)
	{
	  
		 a[i]=cc(x,y);
		 b[i]=x*y/a[i];
	     i++;	
	     
	    
	}
	for(int j=0;j<i;j++)
	{
		printf("%lld %lld\n",a[i],b[i]);
	}
}

C++: 
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
using namespace std;
typedef long long int ll;

ll gcd(ll n, ll m){
    if (n>=m) {
        if(n%m>0){
            return gcd(m,n%m);
        }else{
            return m;
        }
    }else{
        return gcd(m,n);
    }
}

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

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

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

C++: // B.cpp

#include <iostream>
#include <cmath>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

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

int gcd(int u, int v)
{
  int r, z;

    if(v > u)
    {
      z = u;
      u = v;
      v = z;
    }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b;

  while(scanf("%d %d", &a, &b))
  {      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }

  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*((float)m/a);
        cout << g << " " << a << endl;
    }
    return 0;
}

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

long int mygcd(long int a, long int b)
{
    if (b == 0) return a;
    if (a < b) return mygcd(b,a);
    return mygcd(a-b,b);
}

int main(void)
{
    long int a,b;

    while(cin >> a)
    {
        cin >> b;
        long int gcd = mygcd(a,b);
        long int lcm = a*b/gcd;

        cout << gcd << " " << lcm << endl;
    }
    return 0;
}

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

	while(scanf("%d%d", &a, &b)!=EOF){

		if (a < b){
			i = a;
			a = b;
			b = i;
		}
		B = b;

		while (1){

			if (b == 0){
				printf("0 ");
				break;
			}

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		if (b == 0){
			printf("%d\n", a);
		}
		else{

			m = a / b;/*/公倍数*/
			m = m*B;
			printf("%d\n", m);
		}
	}

	return 0;
}

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

int main()
{
    int a,b,c,d,tmp=0;
    
    while(cin >> a >> b){
        if (a<b) {
            swap(a,b);
        }
        c = a;
        d = b;
        
        while (b) {
            tmp = b;
            b = a % b;
            a = tmp;
        }
        
        cout << a << " " << c*d/a << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
long long a,b;
void yakusuu (int i,int j){
	while(i>=0){
	     while(i<j){
		       j=j-i;
	      }
	     while(j<i){
		       i=i-j;
	     }
         if(i==j){
		    cout<<i<<" " ;
		    break;
	     }
    }
}
void baisuu (int i,int j){
	for(int m=1;m<=20000000000;m++){
		if(m%i==0&&m%j==0){
			cout<<m<<endl;
			break;
		}
	}
}
int main(){
	while(cin>>a>>b){
	    yakusuu(a,b);
	    baisuu(a,b);
    }
	 
}

C++: //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005

#include <iostream>
using namespace std;
#define ll long long
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }


int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

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

int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		cout << GCD(a,b) << " " << a/GCD(a,b)*b << endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int gcd(int x,int y){
  if(y>x){
    int t=x;
    x=y;
    y=t;
  }
  while(true){
    int t=y;
    y=x%y;
    x=t;
  
    if(y==0){return x;}
  }
}

int lcm(int x,int y){
  return (double)x/gcd(x,y)*y;//オーバーフロー防止

}


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

C++: #include <stdio.h>
typedef long long ll;

ll gcd(ll a, ll b) {
  ll t;
  while( b ) {
    t = a % b;
    a = b;
    b = t;
  }
  return a;
}

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

C++: #include <algorithm>
#include <iostream>
using namespace std;
 
int main() {
  long long a, b;
  while (cin >> a >> b) {
    long long g = __gcd(a, b);
    cout << g << " " << a * b / g << endl;
  }
}

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

int gcd(int a, int b) {
   int p,q,r;
   if(a<b){p=b;b=a;a=p;}
   while(r!=0){
       q=b/a;
       r=a%b;
       b=a;
       a=r;
   }
   return b;
}

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;
}