Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    cout << endl;
    }

}

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

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

	return gcd(b, a%b);
}


int main(){

	while (true){
		int a, b;
		cin >> a >> b;

		if (cin.eof())
			break;

		int g = gcd(a, b);
		cout << g << " " << a / g*b << 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(){
	while(true){
		int a,b;
		cin>a>>b;
		
		if(cin.eof())
			break;
			
		cout<<n_prime[n]<<endl;
	}
	return 0;
}

C++: #include <iostream>                                             
using namespace std;                                            
typedef long long ll;                                           
                                                                
int GCD(ll a,ll b) {                                            
  if (b==0) {                                                   
    return a;                                                   
  }                                                             
  return GCD(b,a%b);                                            
}                                                               
                                                                
int LCM(ll a,ll b) {                                            
  return a*b/GCD(a,b);                                          
}                                                               
                                                                
int main() {                                                    
  ll a, b;                                                      
  while (cin >> a >> b) {                                       
    cout << GCD(a,b) << " " << LCM(a,b) << endl;                
  }                                                             
  return 0;                                                     
}

C++: #include <iostream>

using namespace std;

int gcd( int m, int n ){
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

int lcm( int m, int n ){
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

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;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

template< typename T >
T gcd(T a,T b) {
	return b ? gcd(b,a%b) : a;
}

template< typename T >
T lcm(T a,T b) {
	return a / gcd(a,b) * b;
}

template< typename T >
T extgcd(T a,T b,T &x,T &y) {
	T g=a;
	x=1,y=0;
	if(b) {
		g = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}
	cout<<a<<' '<<b<<' '<<x<<' '<<y<<' '<<g<<endl;
	return g;
}

template< typename T >
T mod_inv(T a,T m) {
	T x,y;
	extgcd(a,m,x,y);
	return (m+ x%m)%m;
}

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>
using namespace std;

int main(){

  int a, b;
  int lcm=1, gcd=1;

  while( cin >> a >> b ) {
    for(int i=a; i>1; i--) {
      if(a%i == 0 && b%i == 0) {
        lcm = i;
        a = a/i;
        b = b/i;
      }
    }
    gcd = a*b*lcm;
    cout << lcm << " " << gcd <<"\n";
    lcm = 1;
    gcd = 1;
  }

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<utility>
#include<queue>
#include<stack>
using namespace std;
const int M=10000000000;
int gcd(int x,int y);
int Lcm(int x,int y,int z);
int main()
{
	int n,m;
	while(scanf("%d %d",&m,&n)!=EOF)
	{
		int a=gcd(m,n);
		int b=Lcm(m,n,a);
		printf("%d %d\n",a,b);
	}
	return 0;
}
int gcd(int x,int y)
{
	if(y==0)
	{
		return x;
	}
	else 
	{
		return gcd(y,x%y);
	}
}
int Lcm(int x,int y,int z)
{
	return x*y/z;
}

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){
		B = b;

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

		while (1){

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

	return 0;
}

C++: #include<stdio.h>
int main(void){
  int a,b,c,d,x,y;
  printf("a,b>");
  scanf("%d,%d",&a,&b);
  for(x=1;x<=a*b;x++){
    if(a%x==0 && b%x==0){
      c=x;
    }
  }
  for(y=a*b;y>=1;y--){
    if(y%a==0 && y%b==0){
      d=y;
    }
  }
  printf("%d,%d",c,d);
  return 0;
}

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

C++: #include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>


using namespace std;

#define Max INT_MAX
#define Inf (INT_MAX/2)
#define Min INT_MIN


#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
// s <= x < g ?
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
// 0 <= x < w && 0 <= y < h ?
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))

typedef pair<int, int> P;
typedef long long ll;



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


int main()
{
    int n;
    while ( 1 ){
        int a,b;
        cin >> a >> b;
        if( a == 0 && b == 0 ) { break; }
        ll G = gcd(a,b);
        cout << G << " " << a * (b / G) << endl;
        //cout << lcm(a,b) << " " << gcd << endl;
    }
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
unsigned int GCD(unsigned int a,unsigned int b) {
	if(a < b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}
	if(b==0) return a;
	GCD(b,a%b);
}
int main() {
	unsigned int a;
	unsigned int b;
	while(cin >> a >> b) {
		unsigned int gcd = GCD(a,b);
		unsigned int lcm = (a / gcd) * b;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}