Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include <stdio.h>
#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);
printf("%d %d\n",lcm, gcd);
    //std::cout << lcm << " " << gcd << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = 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 <iostream>
#include <cmath>

int gcd(int x,int y);
int lcm(int x,int y);

int main(){
  int a,b;
using namespace std;

  while(1){
  cin >> a >> b;
  if(cin.eof())break;
  cout << gcd(a,b)<<" "<<lcm(a,b)<<endl;
  }
  return 0;
}

int gcd(int x,int y){
  int z;
  while(y!=0){
  z = x%y;
  x = y; 
  y = z;
  }
  return x;
}

int lcm(int x,int y){
  int g = gcd(x,y);
  return x/g*y;
}

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

using namespace std;

long long int find_GCD(long long int a, long long int b){
  long long int max = 0;
  for(int i=min(a, b);i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

long long int find_LCM(long long int a, long long int b){
  long long int LCM;
  for(int i=max(a, b);i<=a*b;i+=max(a, b)){
    if(i%a==0 && i%b==0){
      return i;
    }
  }
}

int main(){
  long long int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
    //    long long int GCD = find_GCD(a, b);
    //    long long int LCM = a*b/GCD;

    long long int GCD;
    long long int LCM;
    LCM = find_LCM(a, b);
    GCD = a*b/LCM;
    cout << GCD << " " << LCM << endl;
  }

}

C++: #include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
#include<algorithm>
#include<set>
#include<map>
#include<deque> 
using namespace std;
#define INF 0x3f3f3f3f
typedef long long LL;
typedef pair<int,int> ppp;

LL a,b;
LL gcd(LL x,LL y){
	return y==0?x:gcd(y,x%y);
}
int main(){
	while (scanf("%lld%lld",&a,&b)){
		LL G = gcd(a,b);
		unsigned long long L = (a/G)*(b/G)*G; 
		printf("%lld %llu\n",G,L);
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
long a,b,c[3];
long gcd,lcm;
int main(){
	while(cin >> a >> b){
		c[0] = a;
		c[1] = b;
		c[2] = a;
		while(c[2]>0){
			c[2] = c[0] % c[1];
			c[0] = c[1];
			c[1] = c[2];
		}
		cout << c[0] << ' ' << a/c[0]*b << endl;
	}
	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[4];

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

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

	return -1;
}

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

// GCD
template<class T> inline T gcd(T a, T b) {
    return (a == b) ? a : gcd(b % a, a);
}

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

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