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>

#define REP(i, n) for(i=0;i<n;i++)
#define MOD_NUM (1000000007)

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

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

		gcd = 1;
		for (i = 2; i <= a && i <= b; i++){
			if (a % i == 0 && b % i == 0){
				gcd *= i;

				a /= i;
				b /= i;
				i--;
			}
		}
		lcm = gcd * a * b;

		printf("%d %lld\n", gcd, lcm);
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int calc_gcd(int a, int b) {
        int bigger = a > b ? a : b;
        int lower = a > b ? b : a;

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

        return b;
}

int calc_lcm(int a, int b) {
        int bigger = a > b ? a : b;
        int lower = a > b ? b : a;

        int ans = bigger;
        while((ans % lower) != 0) {
                ans = ans + bigger;
        }

        return ans;
}

int main(void) {
        int a,b;

        while(cin >> a >> b) {
                cout << calc_gcd(a,b);
                cout << " ";
                cout << calc_lcm(a,b);
                cout << endl;
        }

        return 0;
}

C++: #include <iostream>
using namespace std;
float LCM(float a,float b)
{
	if(a==b)
	return a;
	else
	{
		if(a>b)
		a-=b;
		else
		b-=a;
		LCM(a,b);
	}
}
int main()
{
	float a,b;
	long c;
	while(cin>>a>>b)
	{
		c=LCM(a,b);
		if(c>100000)
			cout<<c/10000<<"0000 "<<(a*b/c)/10000<<"0000"<<endl;
		else if((a*b/c)>100000)
			cout<<c<<" "<<(a*b/c)/10000<<"0000"<<endl;
		else
			cout<<c<<" "<<(a*b/c)<<endl;
	}
}

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

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return(a);
}

int main(){
    int data0,data1;
    int answer;
    while(cin>>data0>>data1){
        answer=gcd(data0,data1);
        cout<<answer<<" "<<data0*data1/answer<<endl;
    }
}

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

int main(int argc, char *argv[]){
    int a,b,r;
	while(cin>>a>>b){
		int a0=a,b0=b;
		r=a%b;
		while(r!=0){
			a=b;
			b=r;
			r=a%b;
		}
	    
		cout <<b<<" "<< a0*(b0/b) << endl;
	}
    return 0;
}

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

int main(){
	long a,b,m,n,tmp;
	
	while(cin>>a>>b){
		if(a>=b){
			m=a;
			n=b;
		}else{
			m=b;
			n=a;
		}
		
		for(;n!=0;){
			tmp=n;
			n=m%n;
			m=tmp;
		}
		
		cout<<m<<" "<<a*b/m<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(){

	int a=0, b=0,i=0,m=0,n=0,B=0,A=0;

	while(scanf("%d%d", &a, &b)!=EOF){
		B = b;
		A = a;
		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 <iostream>
using namespace std;
int main(void){
    int x, y, a, i, r;
    cin >> x >> y;
    while(x != 0 || y != 0){
        i = 0;
        
        if(y > x){
            a = x;
            x = y;
            y = a;
        }

        while(y != 0){
            r = x % y;
            x = r;
            r = y;
            y = x;
            x = r;
            i++;
        }
        
        cout << x << " " << i << endl;
        cin >> x >> y;
    }
    
}

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

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

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long int64;
int main(){
  int a,b;
  int temp;
  int i;
  int gcd,lcm;
  int64 A,B;
  while(scanf("%d %d",&a,&b) != EOF){
    A = a;
    B = b;
    while(b != 0){
      temp = a % b;
      a = b;
      b = temp;
    }
    gcd = a;
    lcm = (A * B) / gcd;
    cout << gcd << " " <<  lcm << endl;
  }
}

C++: #include <stdio.h>
#include <iostream>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
    std::cout << a << " " << b << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a %= b;
    }else{
      b %= a;
    }
  }
  
  if(a==1) return b;
  else     return a;
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0) return i;
      else i++;
    }else{
      i++;
    }
  }
}

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

int main() {
	int a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if ((max(a, b) % min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = a%b;
			}else b = b%a;
		}
			cout << " " << c * d / min(a,b);
	}

	return 0;
}

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

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

    return gcd(b, a % b);
}

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

int main(void)
{
    int a, b;

    while(std::cin >> a >> b)
    {
        if(a < b)
        {
            std::swap(a, b);
        }
    
        const int g = gcd(a, b);
        const int l = lcm(a, b, g);
    
        std::cout << g << " " << l << std::endl;
    }

    return 0;
}

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

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

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[3];

	tmp[0] = std::max( a, b );
	tmp[1] = std::min( a, b );

	for( n = 0;; n++ ){
		for( i = 1;; i++ ){
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i;
			if( tmp[( n + 2 ) % 3 ] < tmp[( n + 1 ) % 3 ] ){
				break;
			}else if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
	}

	return -1;
}

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

int main()
{
	int lam,gcd,a,b,c,d;
	while(cin>>a>>b)
	{
		c=a;
		d=b;
		if(a<b)
		{
			a=a+b;
			b=a-b;
			a=a-b;
		}
		while(a%b!=0)
		{
			int temp;
			temp=b;
			b=a%b;
			a=temp;
		}
		gcd=b;
		lam=d/gcd*c;
		printf("%d %d\n",gcd,lam);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
	while(cin >> a >> b) {
	  cout << __gcd(a, b) << " " << (a*b)/__gcd(a, b) << endl;
	}
  return 0;
}