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() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, 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
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

func lcm(x, y int) int {
	return (x * y) / gcd(x, y)
}

C++: #include<iostream>
using namespace std;
int main(){
  long int sn = 0;
  long int bn = 0;
  long int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0) lcm = i;
    break;
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0) gcd = i;
    break;
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}

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

using namespace std;

//最大公約数 gcd
double gcd(double a, double b){
	while (a != b){
		a > b ? a -= b : b -= a;
	}
	if (a == b) return a;
}

//最小公倍数 lcm
double lcm(double a, double b){
	return a*b/gcd(a, b);
}

int main(){
	int a, b;
	while (cin >> a >> b){
		printf("%.0f %.0f\n", gcd(a, b), lcm(a, b));
	}
	return 0;
}

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

int main() {
	int64_t a, b;
	while (cin >> a >> b) {
		int64_t GCD, LCM;
		int64_t n = a,
			m = b;
		while (1) {
			int64_t n = a % b;
			if (!n) {
				GCD = b;
				break;
			}
			else {
				a = b;
				b = n;
			}
		}

		LCM = n * m / GCD;
		cout << GCD << ' ' << LCM << endl;
	}
}

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

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

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

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

C++: #include<bits/stdc++.h>

using namespace std;


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


    return 0;
}

C++: #include<iostream>

unsigned x,y;

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

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

int main(){
	while(std::cin >> x >> y)
		std::cout << gcd(x,y) << ' ' << lcm(x,y) << std::endl;
	return 0;
}

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, tmp;
   if (a < b){
       tmp = b;
	b = a;
	a = tmp;

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

C++: #include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
    if(b==0)
        return a;
    return gcd(b,a%b);  //递归求最大公约数
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;    //递归求最小公倍数
}
int main()
{
    ll a,b;
    while(cin >> a >> b)
    {
        cout << gcd(a,b)<< " "<<lcm(a,b)<<endl;
    }
    return 0;
}

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

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if (a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

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

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 << lcm << " " << gcd << 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 <iostream>

using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << a << " " << a << endl;
		}
	}
	return 0;
}

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;
}