Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
long long a,b,aa,bb;
long long c,d,tmp;
while(cin>>a>>b){
        if(a < b)swap(a,b);
        aa=a;
        bb=b;
        while(b!=0){
                tmp = a%b;
                a = b;
                b = tmp;
        }
        c=aa*bb/a;
        cout<<a<<' '<<c<<endl;
}
        return 0;
}

C++: #include <iostream>			//std::cout, std::cin
#include <string>			//std::string,std::to_string(C++11)
#include <vector>			//std::vector
#include <valarray>			//std::valarray
#include <algorithm>		//std::sort
#include <ctime>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs,std::pow,sqrt,sin,cos,round,floor,ceil
#include <fstream>			//std::ifstream,std::ofstream
#include <iomanip>			//std::setprecision,std::setw,std::setfill
#include <random>			//std::random(C++11)
#include <numeric>			//std::accumulate
#include <functional>		//std::greater
#include <chrono>			//std::chrono(C++11)
#include <bitset>			//std::bitset
#include <queue>			//std::queue

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;

unsigned long long Greatest_Common_Divisor(unsigned long long a, unsigned long long b) {

	while (a != 0 && b != 0) {
		if (a > b) {
			a = a - b;
		}
		else {
			b = b - a;
		}
	}
	return(a + b);
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	//std::ofstream ofs("456.csv");
	//std::chrono::system_clock::time_point t_st = std::chrono::system_clock::now();

	unsigned long long a = 0, b = 0;
	std::vector<unsigned long long> GCD,LCM;

	while (std::cin >> a) {
		std::cin >> b;
		GCD.push_back(Greatest_Common_Divisor(a, b));
		LCM.push_back(a*b / GCD.back());
	}

	for (unsigned int i = 0; i < GCD.size(); i++) {
		std::cout << GCD[i] << " " << LCM[i] << std::endl;
	}

	//std::chrono::system_clock::time_point t_ed = std::chrono::system_clock::now();
	//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t_ed - t_st).count() << "ms" << std::endl;

}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e;
	
	for(int i=0;i<2;i++){
	std::cin>>a>>b;
	d=a;
	e=b;
	if(b>a){
		d = a;
		a = b;
		b = d;
	}
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
std::cout<<a<<" "<<((e/a)*(d/a)*a)<<endl;8
	}
}

C++: #include <iostream>

int main() {
  long a,b;

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

    long min;
    long cnt = 2;

    do {
      while((a % cnt == 0) && a % cnt == b % cnt) {
        a /= cnt;
        b /= cnt;
        gcd *= cnt;
      }
      min = (a < b) ? a : b;
      ++cnt;
    }while(min > cnt);

    lcm = gcd * a * b;
    std::cout << gcd << " " << lcm <<std::endl;
  }

}

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

using namespace std;

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

int main(){
	long long a, b;
	while (scanf("%lld%lld", &a, &b) != EOF)
	{
		int d = gcd(a, b);
		int  lcm = a /d *b;
		printf("%d %d\n", d, lcm);
	}
}

C++: #include <stdio.h>

int
main(void)
{
	char line[80];
	unsigned long a;
	unsigned long b;

	while (gets(line)) {
		if (sscanf(line, "%lu %lu", &a, &b) == 2) {
			unsigned long x = a;
			unsigned long y = b;
			unsigned long q;
			unsigned long r;
			while (true) {
				q = x / y;
				r = x - q * y;
				if (r == 0) {
					break;
				}
				x = y;
				y = r;
			}
			printf("%lu %lu\n", y, (a/y)*b);
		}
	}

	return 0;
}

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

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

int main(){
	int a, b, c, d;

	while(cin >> a >> b){
		c=gcd(a, b);
		d=lcm(a, b);

		cout << c << " " << d << endl;
	}

	return 0;
}

int gcd(int a, int b){
	int d, e, f;

	if(a>=b){ d=a; e=b; }
	else { d=b; e=a; }
	f=e;
	while(1){
		if(d%f==0) return f;
		f=d % e;
		d=e;
		e=f;
	}
}

int lcm(int a, int b){
	int c=gcd(a,b);
	int d;
	d=a;
	d /= c;
	d *= b;
	return d;
}

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

int main(){
	int a, b, lcm, gcm;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			_a = _a % _b;
			if(_b % _a == 0){
				gcm = _a;
				break;
			}
			std::swap(_a, _b);
		}
		lcm = a / gcm * b;
		std::cout << gcm << ' ' << lcm << std::endl;
	}
	return 0;
}

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

int main(void)
{

	long a,b,ax,bx;

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

	if(a < b)
		swap(a,b);

	ax = a,bx = b;


	long c;
	while(ax % bx != 0){
		c = bx;
		bx = ax%bx;
		ax = c;
	}

	int ans;

	if(a % b == 0)
		ans = a;
	else
		ans = (a/bx)*(b/bx)*bx;

	cout << bx << ' ' << ans << endl;

	}

	return 0;
}

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

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

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

using namespace std;

int gcd(int a, int b) {
    return b > 0 ? gcd(b, a % b) : a;
}
int main() {
    int  a, b;
    while (scanf("%d%d", &a, &b) != EOF) {
        printf("%d %d\n", gcd(a, b), a / gcd(a, b) * b);
    }

    return 0;


}

C++: #include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	if(b<=0){
		return a;
	}else{
		return gcd(b,a%b);
	}
}
int lcm(int a,int b){
	return (a/gcd(a,b))*b;
}	
int main() {
	long long 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<cmath>

using namespace std;

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

int main(void){

  int a,b;

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

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

int main(){
const int INF=1000000;
int a[INF];
int gcd,lcm;
while(cin>>a[0]>>a[1]){
for(int i=0;i<INF;i++){
if(a[i]>a[i+1]){a[i+2]=a[i]-a[i+1];}
if(a[i+1]>a[i]){a[i+2]=a[i+1]-a[i];}
if(a[i+1]==a[i]){gcd=a[i]; break;}}
lcm=a[0]*a[1]/gcd;
cout<<gcd<<" "<<lcm<<endl;}}

C++: #include <stdio.h>
int main(void){
    int a,b,d;
    while(~scanf("%d%d",&a,&b)){
        int&t=a<b?a:b,n=1;
        d=t;
        while(d>1){
            if(a%d||b%d)d--;
            else a/=d,b/=d,n*=d,d=t;
        }
        printf("%d %d\n",n,n*a*b);
    }
    return 0;