Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

C++: #include <cstdio>
int gcd (int a, int b) {
	while (true) {
		if (a > b)
			a -= b;
		else if (a < b)
			b -= a;
		else
			break;
	}
	return a;
}
int lcm (int a, int b) {
	int sum_a = a;
	int sum_b = b;
	while (true) {
		if (sum_a > sum_b)
			sum_b += b;
		else if (sum_a < sum_b)
			sum_a += a;
		else
			break;
	}
	return sum_a;
}
int main ( int argc, char *argv[] ) {
	using namespace std;
	int a, b;
	while (EOF != fscanf(stdin, "%d %d\n", &a, &b)) {
		printf("%d %d\n", gcd(a, b), lcm(a, b));
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

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

C++: #include<iostream>
using namespace std;
int gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  cin>>a>>b;
  d=gcd(a,b);
  c=a*(b/d);
  cout<<d<<' '<<c<<endl;
  return 0;
}

int gcd(long long x,long long 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>

using namespace std;

int main() {
	long long int a, b, c, d, m, i;
	while (cin >> a >> b) {
		for (i = 0;i < b;i++) {
			for (m = 0;m < a;m++) {
				if (a*(i + 1) == b*(m + 1)) {
					c = a*(i + 1);
					i = -1;
					break;
				}
			}
			if (i == -1) { break; }
		}
		if(a > b){
			for (i = a;i > 0;i--) {
				if (a%i == 0 && b%i == 0) { break; }
			}
		}else{
			for (i = b;i > 0;i--) {
				if (b%i == 0 && a%i == 0) { break; }
			}
		}
		d = i;
		cout << d << ' ' << c << endl;
	} 
	return 0;
}

C++: 
#include <stdio.h>

int main()
{
	long int a,b,a1,b1;
	long int r;
	while(scanf("%ld %ld",&a1,&b1) != EOF){
		a = a1;
		b = b1;
		if(a < b){
			r = b;
			b = a;
			a = r;
		}
		if(a <= 0 || b <= 0){
			return 0;
		}
		r = a % b;
		while(r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		printf("%ld %ld\n", b, a1 / b * b1);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,gcd,lcm,tmp,r,num_a,num_b;
while(cin>>num_a>>num_b){
a=num_a,b=num_b;
if(a<b){
tmp = a;
a = b;
b = tmp;
}
r=a%b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
gcd = b;
lcm = (num_a*num_b)/gcd;
cout<<gcd<<" "<<lcm<<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;



int gcd( long long  a, long long 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; }
        long long  G = gcd(a,b);
        cout << G << " " << a * (b / G) << endl;
    }
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd,lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 1;;i++){
			if(((int)(a/i)) == a/(float)i && b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		
		printf("%ld %ld\n",gcd,lcm);
	}
	
	return 0;
}

C++: #include <iostream>

int main()
{
        int a, b, t, GCD;
        while(std::cin >> a >> b)
        {
                t = a, GCD = b;
                while(t != GCD)
                        if(t > GCD)
                                t -= GCD;
                        else
                                GCD -= t;
                std::cout << GCD << " " << (a / GCD)*b << std::endl;
        }
        return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b,GCD,LCM,r,xa,xb;
	while(cin>>a>>b){
		xa=a;xb=b;
		while(xa!=xb){
			if(xa>xb){
			xa = xa%xb;
			}
			else{
			xb = xb%xa;
			}

		}
		
		LCM=(a*b)/xb;
		cout<<xb<<" ";
		cout<<LCM<<endl;
	}

	return 0;

}

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

int main(void) {
	int a, b;
	cin >> a >> b; 
	cout << gcd(a, b) << " " <<  lcm(a, b) << endl;

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

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

using namespace std;

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

	while (cin >> a >> b){
		int ac, bc;
		ac = a;
		bc = b;
		if (bc > ac) swap(ac, bc);
			while (ac % bc != 0){
				ac %= bc;
			if (bc > ac) swap(ac, bc);
		}
		gcd = bc;
		lcm = a / gcd * b;
	
		cout << gcd << " " << lcm << endl;
		}
	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;
while(cin >> a >> b) cout << gcd(a,b) << " " << a * b / gcd(a,b) << endl;
return 0;
}

C++: //Simultaneous Equation

#include <iostream>
#include <utility>
#include <cstdio>
#include <cassert>

namespace {

template <class T>
T GreatestCommonDivisor(T a, T b)
{
  // a must be less than b
  if (a > b) std::swap(a, b);

  while (a != 0) {
    T tmp = b % a;
    b = a;
    a = tmp;
  }

  return b;
}

template <class T>
T LeastCommonMultiple(T a, T b)
{
  // a must be less than b
  if (a > b) std::swap(a, b);

  T lcm = b;
  while (lcm % a != 0) {
    lcm += b;
  }

  return lcm;
}

} // unnamed namespace

int main()
{
  while (1) {
    long a, b;
    std::cin >> a >> b;
    if (std::cin.fail()) break;

    std::cout
      << GreatestCommonDivisor(a, b) << " "
      << LeastCommonMultiple(a, b) << std::endl;
  }

  return 0;
}

C++: #include<iostream>
#include<utility>
 
int main(){
    unsigned int a, b, tmp, GCD;
    while ( std::cin >> a >> b){
        if( b > a )std::swap( a , b );
        unsigned long int LCM = a;
        GCD = b;
        while(a % GCD != 0){
            tmp = a % GCD;
            a = GCD;
            GCD = tmp;
        }
        LCM = ( LCM / GCD ) * b;
        std::cout << GCD << " " << LCM << std::endl;
    }
    return 0;
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		int gcd = 0;
		long long lcm = 0;
		int r = 0;
		int temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}