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<stdio.h>

int gcd( int a, int b )
{
 	while( a != 0 && b != 0 ){
		a %= b;
		if( a == 0 ) break;
		b %= a;
		if( b == 0 ) break;
	}
	
	return a + b;
}

int lcm( int a, int b )
{
	return a / gcd( a, b ) * b;
}

int main()
{
	int a, b;
	while( scanf( "%d %d", &a, &b ) != EOF ){
		printf( "%d %d\n", gcd( a, b ), lcm( a, b ) );	
	}

 	return 0;
}

C++: #include<iostream>
using namespace std;
int GCD(int n,int m){
  if(n<m){
    int t;
    t = m;
    m = n;
    n = t;
  }
  int i;
  while(n%m != 0){
    i = n%m;
    n = m;
    m = i;
  }
  return m;
    
}
int main(){
  int n,m,i=0,a[50],b[50];
  while(cin >> n >> m){
    a[i] = GCD(n,m);
    b[i] = n*m/GCD(n,m);
    i++;
    n = 0;
    m = 0;
  }
  for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << 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 lcm(int a,int b){
  return a / gcd(a,b) * b;
}

int main(){
  int a,b;

while(cin >> a >> b){
  cout << gcd(a,b) << " " << lcm(a,b) << "\n"; 
}
  return 0;
}

C++: #include <stdio.h>


using namespace std;

typedef long long ll;

int gcd(int x,int y) {
        return y > 0 ? gcd(y,x % y) : x;
}
int main() {

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

}

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

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

int main(){
	int a, b, min ,max, gcd, lcm;
	
	while(cin >> a >> b){
		
		min = min(a, b);
		max = max(a, b);
		
		for(int i = 0; i < min; i++){
			if(min % i == 0 && max % i == 0) gcd = i;
		}
		
		while(1){
			int i = 1;
			if( (max * i) % min == 0) {
				lcm = max *i;
				break;
			}
			else i++;
		}
	}	
		cout << gcd <<  " " << lcm << endl;
}

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

using namespace std;

int a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}




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

long long lcm(int a, int b){
    long long g(gcd(a, b));
    return a / g * b;
}



int main(){
    int a, b;
    while(std::cin >> a >> b){
        std::cout << gcd(a, b) << " " << lcm(a, b) << "\n";
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	int a,b,r;
	while(cin>>a>>b)
	{
		int a1=a,b1=b;
		while(r=a%b)
		{
			a = b;
			b = r;
		}
		cout<<b<<" "<<a1/b*b1;        //先除再除?少数量? 
	}
	return 0;
}

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

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

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

C++: #include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{
    if (!b) return a;
    else return gcd(b,a%b);
}

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

C++: #include"iostream"
#include"iomanip"
#include"string"

using namespace std;

int gcd(int a, int b)
{
	int t;
	while (b!=0)
	{
		t = a;
		a = b;
		b = t%b;
	}
	return a;
}

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

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

long long gcd(long long m, long long n){

	if(m<n){
		long long swap;
		swap = m;
		m = n;
		n = swap;
	}

	do {
		if(n==0){
			return m;
		}
		
		int swap = m % n;
		m = n;
		n = swap;
	} while(1);
}


int main(){
//	m*n = LCM * GCD
	long long m, n;
	while(cin >> m >> n){
		long long  LCM, GCD;
		
		GCD = gcd(m, n);
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	return 0;
}

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

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

int main()
{
    long long a;
    long long b;
    while(scanf("%I64d%I64d",&a,&b)!=EOF)
    {
        printf("%I64d %I64d\n",gcd(a,b),a/gcd(a,b)*b);
    }
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
int gcd(int x,int y)
{
	if(y==0)return x;
	return gcd(y,x%y);
}
int main()
{
    int a,b;
	while(cin >> a >> b){
		int z=gcd(a,b);
        int w=a/z*b;
		printf("%d %d\n",z,w);
	}
    return 0;
}

C++: // GCDandLCM.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;

double eucAlg(int a,int b);


int main(int argc, char* argv[])
{
	double a,b;	//??\??????
	double c, d;	//??????

	while(cin >> a >> b){

		c = eucAlg(a, b);

		d = a * b / c;
		cout << fixed << setprecision(0) << c << " " << d << endl;
	}
	return 0;
}

//??????????????????????????????
double eucAlg(
	int a,
	int b
	)
{
	double c;

	do
	{
		c = a % b;
		if(c == 0){
			break;
		}
		a = b;
		b = c;

	}while(1);

	return b;
}

C++: #include <iostream>
 
using namespace std;
 
int main(){
 
    unsigned long long a,b,c,d;
 
    while(cin>>a>>b){
        c=a;
        d=b;
        while(1){
            if(c>d)c=c-d;
            if(c<d)d=d-c;
            if(c==d){
                cout<<c<<" "<<a*b/c<<endl;
                ;break;}
        }}
         
 
 
return 0;
}