Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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>
#include <cstdio>
using namespace std;
int main(){
	unsigned long long a,b,c,d,maxx=0,minn=0;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=a;
			else{
				maxx=a%d;
				if (maxx==0)maxx=d;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int gcd(int a, int b){ return a%b ? gcd(b, a%b) : 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) << endl;
  }
}

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*b/gcd(a,b);    //递归求最小公倍数
}
int main()
{
    ll a,b;
    while(cin >> a >> b)
    {
        cout << gcd(a,b)<< " "<<lcm(a,b)<<endl;
    }
    return 0;
}

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

using namespace std;

long calc_gcd(long num1, long num2) {
  long greater = max(num1, num2);
  long less = min(num1, num2);
  long remainder = greater % less;

  if(remainder == 0) {
    return less;
  }

  return calc_gcd(less, remainder);
}


int main() {
  long num1, num2;

  while(cin >> num1 >> num2) {
    long gcd = calc_gcd(num1, num2);

    cout << gcd << ' ' << num1 * num2 /gcd << endl;
  }
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		if (a < b){
			long long n = b;
			b = a;
			a = n;
		}
		long long times = a * b;
		vector<int> num;
		long long gcd,lcm;
		while(1){
			long long n;
			n = a % b;
			if(n == 0){
				break;
			}
			a = b;
			b = n;	//ユークリッドの互除法
		}
		gcd = b;
		lcm = times / gcd;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y)
{
    while(y>0) {
        x = x%y;
        x^=y^=x^=y;
    }
    return x;
}

ll lcm(ll x, ll y)
{
    return (x * y)/gcd(x, y); 
}

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

}

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

using namespace std;

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

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

C++: #include<iostream>
#include<cmath>
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;
}

C++: import java.util.*;

class Main {
	public static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int g = gcd(a, b);
			System.out.println(g + " " + a / g * b);
		}
	}
}

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

int main()
{
	long int a,b,i,min,max,x,y; //x最大公約数 y最小公倍数

	while(cin>>a>>b){
		x=y=0;
		if(a<b){
			min=a; max=b;
		}else{
			max=a; min=b;
		}

		for(i=2,x=0 ;x==0 ;i++){
			if(min%i==0 && max/(min/i)==0) x=i;
		}
		for(i=max,y=0 ;y==0 ;i+=max){
			if(i%min==0) y=i;
		}

		cout<<x<<" "<<y<<endl;
	}
}

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

typedef long long i64;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int a, b;
  while(cin >> a >> b, !cin.eof()) cout << gcd(a, b) << " " << lcm(a, b) << endl;
}

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

int main() {
	double a, b, c, d, i;
	while(1) {
		cin >> a >> b;
		c = a;
		d = b;
		while (1) {
			if (a == b) {
				cout << a;
				break;
			}else if(a > b) {
				a -= b;
			}else b -=a;
		}
			cout << " " << c * d / a << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(){
	long long int a,b,x,y;
	scanf("%lld%lld",&a,&b);
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld\n",a,x/a*y);
	return 0;
}

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

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

		cout << gcd << ' ' << lcm << endl;
	}
}

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

int main() {
	int c, d;
	while(cin >> c >> d){
		int a=0, b=0, gcd;
		long int lcm;
		a += c;
		b += d;
		if(a<b){
			int tmp = a;
			a = b;
			b = tmp;
		}
		int r = a % b;
		while(r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		gcd = b;
		lcm = c/gcd*d;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#define esp 1e-8
using namespace std;
typedef long long ll;
int n,k;
double a[10005];
int main()
{
    ll a,b;while(cin>>a>>b)
    {
        ll gcd=__gcd(a,b);
        ll lcm=a*b/gcd;
        cout<<gcd<<" "<<lcm<<endl;
    }
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
long long gcd(long long a,long long b)
{
	long long c;
	while (a%b!=0) {
		c=a%b;
		a=b;
		b=c;
	}
	return b;
}
int main()
{
	//freopen("GCDLCM.in","r",stdin);
	//freopen("GCDLCM.out","w",stdout);
	long long a,b,maxy,minb;
	while (cin>>a>>b) {
		maxy=gcd(a,b);
		minb=a*b/maxy;
		cout<<maxy<<" "<<minb<<endl;
	}
	return 0;
}

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>>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 << "1" << " " << a << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
cout<<x<<" "<<L<<endl;
x=0;y=0;
  ++i;
  if(i==49){break;}
}
  return 0;
}