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

int main(){

    int buf1[50],buf[50];

    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;

    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b 1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else printf( "%d ",b2 );

        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ){
                printf( "%d\n",m );
                break;
        }
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    reutrn 0;
}

C++: #include <stdio.h>

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

while(scanf("%d %d",&a,&b) != EOF){
if(a>=b){
for(i=1;i<=b;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
else if(b>a){
for(i=1;i<=a;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
if(a>=b){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(a*i==b*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
else if(b>a){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(b*i==a*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
printf("%d %d\n",x,y);
}
return 0;
}

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

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

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),std::__gcd(a,b)*b);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;

    int g=gcd(a,b);
    cout<<g<<' '<<a/g*b<<endl;
  }

  return 0;
}

C++: #include <cstdio>
using namespace std;
int a, b, d, e;
int gcd(int x, int y)
{
	if (x<y)
	{
		x+=y;
		y=x-y;
		x-=y;
	}
	if (y==0)
	return x;
	else
	return gcd(y, x%y)
}
int lcm(int x, int y)
{
	return (long long)x*y/d;
}
int main()
{ 
	while (scanf("%d%d", &a, &b)!=EOF)
	{
		d = gcd(a,b);
		e = lcm(a, b);
		printf("%lld %lld\n", d, e);
	}
}

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

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

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

C++: #include <stdio.h>

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

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

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

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

int main(){
    int A,B;
	while(cin>>A>>B){
		printf("%d %d\n",gcd(A,B),A*B/gcd(A,B));
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
int getmax(int a,int b){
	if(b==0) return a;
	return getmax(b,a%b);
}
int getmin(int a,int b){
	return a*b/getmax(a,b);
}
int main(){
	int a;
	int b;
	int t;
	while(scanf("%d%d",&a,&b)){
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
	cout<<getmax(a,b)<<endl;
	cout<<getmin(a,b)<<endl;
	}
	return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		//if(b==0)break;
	}
	if(a!=0)cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;
		gcd = b;
		while (a % b != 0){
			r = a % b;
			a = b;
			gcd = a;
			b = r;
		}

		lcm /= gcd;

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

	return 0;
}

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int t;
	for (t = 0; t < 50; t ++) {
		int a, b, i, GCD, LCM;
		cin >> a >> b;
		if (a > b) {
			swap(a, b);
		}
		for (i = 1; i <= a && i <= b / 2; i++) {
			GCD = GCDr(a, b, i, GCD);
		}
		GCDr(a, b, i, GCD);
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

C++: #include <stdio.h>

long long int a ;
long long int b ;

long long int gcd ( ) ;

int main ( )
{
	while ( scanf ( "%lld %lld" , &a , &b ) == 2 ) {
		long long int oa = a ;
		long long int ob = b ;
		long long int tmp = gcd ( ) ;
		printf ( "%lld %lld\n" , tmp , oa / tmp * ob ) ;
	}
	return 0 ;
}

long long int gcd ( )
{
	while ( ( a %= b ) && ( b %= a ) ) ;
	return ( a + b ) ;
}

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


 
int main(){
	int in[2],a,b,ans[2],i = 1,n,stop = 1;
	while(cin >> in[0] >> in[1]){
		a = in[0];
		b = in[1];
		if(a >= b){
			while(a >= 0){
				if(in[0] % a == 0 and in[1] % a == 0){
					ans[0] = a;
					break;
				}
				a--;
			}
		}else if(b >= a){
			while(b >= 0){
				if(in[0] % b == 0 and in[1] % b == 0){
					ans[0] = b;
					break;
				}
				b--;
			}
		}else{
			ans[0] = 1;
		}
		cout << ans[0] << endl;
		a = in[0];
		b = in[1];
		ans[1] = 1;
		n = 1;
		i = 1;
		while(i <= a or i <= b and stop == 1){
		n = 1;
		cout << " << i = " << i << endl;			
			while(i >= n){
				cout << "n = " << n << endl;
				if(a * i == b * n){
					ans[1] = a * i;
					stop = 0;
					break;
				}
				n++;
			}
		
		i++;
		}
		stop = 1;
		cout << ans[1] << endl;
		
	}
}

C++: #include <stdio.h>

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

int lcm(int a, int b){
	if ((a==0)||(b==0)){
		return 0;
	}
	return ((a / gcd(a, b)) * b);
}

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

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

long gcd(long a, long b){
	if (a % b == 0){
		return b;
	}
	else {
		return (gcd(b, a%b));
	}
}
long lcm(long a, long b){
	long gc = gcd(a,b);
	long x = a*b;
	x = x / gc;
	return x;

}

int main(){
	long a,b;
	while (cin >> a >> b){
		long gc = 0;
		if (a >= b){
			gc = gcd(a, b);
		}
		else{
			gc = gcd(b,a);
		}
		long lc = 0;
		if (a >= b){
			lc = lcm(a, b);
		}
		else{
			lc = lcm(b,a);
		}
		cout << gc << " " << lc << endl;

		

	}



	return 0;
}

C++: #include <stdio.h>

typedef long long ll;

ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}

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

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