Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		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.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include<iostream>

using namespace std;

int main()
{
	
	int a, b;
	int temp;
	int big, small;
	
	while(cin>>a>>b){
		
		if(a < b){
			big = b;
			small = a;
		}
		else{
			big = a;
			small = b;
		}
		
		for(;;){
			temp = big % small;
			if(temp == 0){
				break;
			}
			if(temp > small){
				big = temp;
			}
			else{
				big = small;
				small = temp;
			}
		}
		cout << small <<" "<< a*b/small << endl;
	}
}

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int GCD(int a,int b)
{
	if (a%b==0)
		return b;
	else
		return GCD(b,a%b);
}
int cmp(const void *a,const void *b)
{
	return *(int*)b-*(int*)a;
}
int main()
{
	float a[2],gcd,lcm;
	while(cin>>a[0]>>a[1])
	{
		if (cin.eof())break;
		qsort(a,2,sizeof(int),cmp);
		gcd=GCD(a[0],a[1]);
		lcm=(a[0]*a[1])/gcd;
		cout<<(int)gcd<<' '<<(int)lcm<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=1,m=1;
	if(a<b)swap(a,b);
	else 
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		
		if(a!=0&&b!=0)if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		if(m==0)m=1;
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
	}
}

C++: #include "stdio.h"

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

	while(scanf("%d %d", &a, &b) != EOF){
		if(a < b) {int t; t = a; a = b; b = t;}

		for(int i = b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll unsigned long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

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

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

long long  a[51];
long long b[51];
long long A[51];
long long B[51];
long long fun(long long _a,long long _b)
{
   long long c;
   while(_b!=0)  /* 余数不?0，??相除，直到余数?0 */
   {
       c=_a%_b;
       _a=_b;
       _b=c;
    }
   return _a;
}
int main()
{
    int i=1;
    while(~scanf("%lld%lld",&a[i],&b[i]))
    {
       A[i]=fun(a[i],b[i]);//最大
       B[i]=a[i]*b[i]/fun(a[i],b[i]);
       i++;
    }
    for(int j=1;j<i;j++)
    {
       printf("%d ",A[j]);
       printf("%d\n",B[j]);
    }
    return 0;
}

C++: #include<stdio.h>
int main(void) {
	long long int a, b, minans = 0, maxans;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		for (long long int i = 2; i < b / 2; i++)
		{
			if (a%i == 0 && b%i == 0)maxans = i;
		}
		for (long long int i = b; i <= a*b; i++)
		{
			if (i%a == 0 && i%b == 0) {
				minans = i;
				break;
			}
		}
		printf("%lld %lld\n", maxans, minans);
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        long long a,b,gcda,gcdb,c;
        while(scanf("%lld %lld",&a,&b)!=EOF){
                if(a<b){
                        swap(a,b);
                }
                gcda=a;
                gcdb=b;
                while(gcda%gcdb){
                        c=gcdb;
                        gcdb=gcda%gcdb;
                        gcda=c;
                }
                printf("%lld %lld\n",gcdb,(a*b)/gcdb);
        }
        return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
/*
int Max(int n, int m){
  vector<int> v1;
  vector<int> v2;
  repp(i,n){
    if(n%i == 0) v1.push_back(i);
    if(m%i == 0) v2.push_back(i);
  }
  int t=0;
  rep(i,v1.size()){
    rep(j,v2.size()){
      if(v1[i] == v2[j] && t < v2[j]) t = v2[j];
    }
  }
  return t;
}*/
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = gcd(n,m);
    int b = n/a*m;
    cout << a << " " << b << endl;
  }
  return 0;
}

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

ll GCD(ll,ll);

int main(void){
	while(1){
		ll a, b, gcd, lcm, temp;
		if( a < b){
			temp = a;
			a = b;
			b = temp;
		}
		cin >> a >> b;
		if(a == 0 || b == 0)
			return 0;
		gcd = GCD(a,b);
		lcm = a * b / gcd;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

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

C++: #include <iostream>

//?????§??¬?´???°????±???????????????°??????(m >= n)
int calcGcd(int m, int n);
//????°???¬?????°????±????????????????????????°??????
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, a, b;
	
	while(std::cin >> a >> b){
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m / gcd * n;
}

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

using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull a, b;
ull gcd(ull a, ull b){
	return b?gcd(b, a%b):a;
} 
int main(){
	//freopen("in", "r", stdin);
	for(;cin>>a>>b;){
		ull _gcd=gcd(a, b), _lcm=a/_gcd*b;
		cout<<_gcd<<' '<<_lcm<<endl;
	}
}

C++: #include<iostream>
using namespace std;
int gcd(int ,int);
int main(){
  int a,b;
  long long c,d;
  cin>>a>>b;

  d=gcd(a,b);
  c=a*(b/d);
  cout<<d<<' '<<c<<endl;

  return 0;
}

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

}

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*b/y) << endl;
	}
	
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double gcd( double m, double n );
double lcm( double m, double n );
int main(int argc, const char * argv[])
{
    double a=0.0;
    double b=0.0;
        
    while(scanf("%lf",&a)!=EOF){
        scanf("%lf",&b);

        double g = gcd(a, b);
        double l = lcm( a,b );
        
        
        printf("%4lf",g);
        printf(" ");
        printf("%4lf\n",l);
        
    }
    
}
double gcd( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n);
}