Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

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

#define MAX 256

int main(void){
	
	int max[50], min[50];
	for (int i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	int a, b;
	int i = 0;

	while (scanf("%d%d", a, b) != EOF){
		while (max[i] == 0){
			for (int j = 0; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		int j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (int j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	int a[2];
	int tmp;
	int GCD = 1;
	int LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		for (size_t i = 1; i < a[0]; i++)
		{
			if (a[0] % i == 0 && a[1] % i == 0)
			{
				GCD = i;
			}
		}

		// ????°???¬?????°????¨????
		for (size_t i = a[0];; i++)
		{
			if (i % a[0] == 0 && i % a[1] == 0) {
				LCM = i;
				break;
			}
		}
		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #import<bits/stdc++.h>
using namespace std;int a,b;main(){while(~scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),a/__gcd(a,b)*b);}

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

int gcd(int a, int b){
	return (b>0)? gcd(b, a%b) : a;
}
int lcm(int a, int b){
	return a / gcd(a, b) * b;
}

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

C++: #include <iostream>

using namespace std;

int gcd(int a, int b)
{
	return (b > 0)? gcd(b , a % b) : a;
}

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

	
	return 0;
}

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

#define add push_back
#define inf 2147000000

#define rep(i,n) for(int i=0;i<n;i++)
#define deb(a) cout<<a<<endl
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	int a,b,bin;
	while(scanf("%d",&a)!=EOF){
		scanf("%d",&b);
	int aa=a,bb=b;
	if(a<b){
		swap(a,b);
	}
	
	while(b != 0){
		
		bin=a%b;
		a=b;
		b=bin;
	}
	
	out(a);
	out(aa+bb/a);
	}
}

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 =  gcd(a,b) / a * b;
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}

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

int main(void){
     long int n,m;
     long int c,e;
     long int l;
     cin >> n >> m;
     c = n;
     e = m;
     while(1){
	  if(c==e){
	       break;
	  }else if(c>e){
	       c = c-e;
	  }else if(c<e){
	       e = e-c;
	  }
     }
     l = (n*m)/c;
     cout << c << " " << l << endl;
     return 0;
}

C++: #include <iostream>
#include <algorithm>
#define llong long long
llong gcd(llong a, llong b)
{
    llong mod;
    mod = std::max(a, b) % std::min(a, b);
    if(mod == 0) return std::min(a, b);
    else return gcd(std::min(a, b), mod);
}
llong lcm(llong a, llong b, llong gcd)
{
    return (a * b) / gcd;
}
int main()
{
    llong a, b;
    while(std::cin >> a >> b)
    {
        llong g = gcd(a, b);
        std::cout << g << " " << lcm(a, b, g) << std::endl;
    }
}

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

int main(){
	int a, b, gcd, lcm, x, y, r;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

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

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int lcm(int a,int b);
int main(){
	for(;;){
		int a,b;
		if(scanf("%d %d",&a,&b) == EOF){break;}
		int x = lcm(a,b);
		int y = a/x*b;
		cout <<x<<" "<<y<<endl;
	}
	return 0;
}
int lcm(int a,int b){
	if (a == 0){return b;}
	return lcm(b%a,a);
}

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

using namespace std;

int gcm(int a, int b){
	
	if(b > a){
	int d;
	d = a;
	a = b;
	b = d;
	}	
	
	int c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	
	}
	return a;
}

int main(){
	long long c,d,e;
	std::cin>>c>>d;

	e = gcm(c,d);

	std::cout<<e<<" "<<(c*d)/e;
}

C++: #include<iostream>
using namespace std;
int main(){
  int sn,bn;
  int p,lcm,gcd;
  while(cin>>sn>>bn){
  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;
    }
  }
  cout << gcd << ' '<< lcm <<endl;
  }
  return 0;
}

C++: #include<cstdio>

int gcd(int a, int b){
    if(a == b)
        return a;
    else if(a > b)
        a -= b;
    else if(a < b)
        b -= a;
    return gcd(a, b);
}

int lcm(int a, int b){

    return (a / gcd(a, b)) * (b / gcd(a, b)) * gcd(a, b);
}

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d %d\n", gcd(a, b), lcm(a, b));
    return 0;
}

C++: 
#include <string>
#include <iostream>
#include <sstream>

unsigned long __gcd(unsigned long a, unsigned long b)
{
//    std::cout << "in __gcd\n";
//    std::cout << "a: " << a << "\nb: " << b << '\n';
    if (b % a == 0) {
//        std::cout << "returning " << a << '\n';
        return a;
    } else {
        return __gcd(b % a ,a);
    }
}

unsigned long gcd(unsigned long a, unsigned long b)
{
    if (a > b)
        return __gcd(b, a);
    return __gcd(a, b);
}

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

int main(void)
{
    int a, b;
    std::string str;

    while (getline(std::cin, str)) {
        std::istringstream str_s(str);
        str_s >> a >> b;

        std::cout << gcd(a, b) << ' ' << lcm(a, b) << std::endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int gcdf(unsigned long long int a,unsigned long long int b);
int gcd(unsigned long long int a,unsigned long long int b);

int main(){
 	unsigned long long int a,b;
	unsigned long long int G,L;
	 
	while(cin>>a>>b){
		G=gcd(a,b);
		L=(a*b)/G;
		cout<<G<<" "<<L<<endl;
		
}
}
	
int gcdf(unsigned long long int a,unsigned long long int b)
{
	return (b == 0?a:gcdf(b,a%b));
}

int gcd(unsigned long long int a,unsigned long long int b)
{
	return (a>b?gcdf(a,b):gcdf(b,a));
}

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

int main() {
  long a,b;

  while(std::cin >> a >> b) {
    long gcd = 1;
    long lcm = 1;

    for(int cnt = (a < b ? a : b); cnt > 1; --cnt) {
      if((a % cnt == 0) && a % cnt == b % cnt) {
        a /= cnt;
        b /= cnt;
        gcd *= cnt;
      }
    }
    lcm = gcd * a * b;
    std::cout << gcd << " " << lcm <<std::endl;
  }

}