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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


#define N 1024

int main()
{
	char buff[N];
	
	while (NULL != fgets(buff, N, stdin))
	{
		int a, b;
		sscanf(buff, "%ld %ld", &a, &b);
		
		int  m, n, k;
		m = a;
		n = b;
		do
		{
			k = m % n;
			m = n;
			n = k;
		} while (0 != k);
		
		printf("%d %d\n", m, a * (b / m));
	}
	return 0;
}

C++: #include <cstdio>

int getGCD(int a, int b)
{
        if (!b) {
                return a;
        }

        return getGCD(b, a % b);
}

int getLCM(int a, int b)
{
        int lcm = a;

        while (lcm % b) {
                lcm+=a;
        }

        return lcm;
}

int main()
{
        int a, b;

        while (scanf("%d %d", &a, &b)) {
                int max = (a > b) ? a : b,
                    min = (a < b) ? a : b;
                printf("%d %d\n", getGCD(max, min), getLCM(max, min));
        }

        return 0;
}

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

void change(long long *a,long long *b);
long long gcd(long long x,long long y);
long long lcm(long long x,long long y);


int main(void){
	long long a, b, gcd1, lcm1;
	while(cin >> a >> b){
		gcd1 = gcd(a,b);
		lcm1 = lcm(a,b);
		
		cout << gcd1 << ' ' << lcm1 << endl;
	}
	return 0;
}

void change(long long *a,long long *b){
	long long temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

long long gcd(long long x,long long y){
	if(x < y)
	change(&x, &y);
	
	while(y){
		x %= y;
		change(&x, &y);
	}
	return x;
}

long long lcm(long long x,long long y){
	long long ans = x*y / gcd(x, y);
	return ans;
}

C++: #include <iostream>

int main(void)
{
	uint32_t a = 0;
	uint32_t b = 0;

	while (std::cin >> a >> b)
	{
		uint32_t a2 = a;
		uint32_t b2 = b;
		if (a < b)
		{
			uint32_t tmp = a;
			a = b;
			b = tmp;
		}
		uint32_t r = 0;
		while (r = (a % b))
		{
			if (r == 0)
			{
				break;
			}
			a = b;
			b = r;
		}
		std::cout << b << " " << a2/b*b2 << std::endl;
	}

	return 0;
}

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

int main()
{
	long int a,b,i,k;

	while(cin>>a>>b){
		long int x=1, y=0;	//x最大公約数 y最小公倍数
		long int large ,small;

		//最小公倍数を求める処理
		if(a<b){small=a; large=b;}
		else{small=b; large=a;}
		for(i=large ;y==0 ;i+=large){
			if(i%small==0) y=i;
		}
		
		//最大公約数を求める処理
		long int ans[1000];
		i=2; k=0;
		while(a>=i && b>=i){
			if(a%i==0 && b%i==0){
				ans[k]=i;
				a/=i; b/=i;
				k++;
			}else{
				i++;
			}
		}
		for(i=0 ;i<k ;i++) x*=ans[i];

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

C++: #include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a, int b){
    int tmp,q,r;
    if(a<b){
        tmp=b;
        b=a;
        a=tmp;
        }
        while(1){
        q=b/a;
        r=b%a;
        b=a;
        a=r;
        }
        return b;
        }
int main(void){
    int a, b;
    while(cin >> a >> b) {
        int lcm = a/gcd(a,b)*b;
        cout << gcd(a,b) << " " << lcm << endl;
        }
        return 0;
    
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long long a,b,yakuans,baians;
	while(cin>>a>>b){
		long long c;
		c=a*b;
		if(b>a)swap(a,b);
		while(1){
			long long r;
			r=a%b;
			if(a%b==0)break;
			a=b;
			b=r;
		}
		baians=c/b;
		cout<<b<<" "<<baians<<endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	long a, b, r, c, d;
	long ta, tb;

	scanf("%d %d", &a,& b);
	ta = a;
	tb = b;

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	d = b * (a  / c);

	printf("%d %d\n", c, d);

	return (0);
}

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

using namespace std;

int main() {
	long a, b;
	while (cin >> a >> b) {

		cout << __gcd(a, b) << " " << a * b / gcd(a, b) << endl;
	}

}

C++: #include <cstdio>
#define ll long long
ll gcb(ll a, ll b) {
    return a ? gcb(b % a, a) : b;
}
ll a, b;
int main() {
    while (~scanf("%lld %lld", &a, &b)) {
        if (a > b) {
            ll t = a;
            a = b;
            b = t;
        }
        ll g = gcb(a, b);
        printf("%lld %lld\n", g, a * b / g);
    }
    return 0;
}

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

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

int main(){
  int a,b;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      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){

  return x/gcd(x,y)*y;

}

C++: #include <iostream>
using namespace std;
int main(void){
    long long int a, b;
    while(cin >> a >> b){
        long long int tmp;
        if(a < b){
            tmp = a;
            a = b;
            b = tmp;
        }

        long long int m = a * b;
        //ユークリッドの互除法を用いて最大公約数を求める
        long long int r = a % b;
        while(r != 0){
            a = b;
            b = r;
            r = a % b;
        }
        long long int gcd = b;

        //続いて、公式を用いて最小公倍数を求める
        long long int lcm = m / gcd;

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

C++: #include <iostream>

using namespace std;

int gcd(int x, int y) {
	int r;
	if(x == 0 || y == 0) {
		return 0;
	}

	while(x % y != 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

long long int lcm(int x, int y) {
	if(x == 0 || y == 0) {
		return 0;
	}
	return ((x / gcd(x, y)) * y );
}

int main() {
	int x, y;

	while(cin >> x >> y) {
		if(x > y) {
			cout << gcd(x, y) << " " << lcm(x, y) << endl;
		}
		else {
			cout << gcd(y, x) << " " << lcm(y, x) << endl;
		}
	}
}

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

int main(){
		long long a, b, gcd, lcm;
		while(cin >> a >> b){
				vector<long long> divisor_a;
				vector<long long> divisor_b;
				for(int i = 2; i <= a; i++){
						if(a % i == 0) divisor_a.push_back(i);
				}
				for(int i = 2; i <= b; i++){
						if(b % i == 0) divisor_b.push_back(i);
				}
				for(int i = 0; i < divisor_a.size(); i++){
						for(int j = 0; j < divisor_b.size(); j++){
								if(divisor_a[i] == divisor_b[j]) gcd = divisor_a[i];
						}
				}
				lcm = a / gcd * b;
				cout << gcd << " " << lcm << endl;
		}
		return 0;
}

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

int lcm(int max, int min) {
    int multiplier = 1;
    while ((max * multiplier) % min != 0) {
        multiplier++;
    }
    return max * multiplier;
}

int gcd(int max, int min) {
    int r = max % min;
    int x = min;
    while (r != 0) {
        int tmp = r;
        r = x % r;
        x = tmp;
    }
    return x;
}

int main(void) {
    int a, b;
    while (scanf("%d %d", &a, &b)+1)  {
        int min = (a < b)? a : b;
        int max = (a < b)? b : a;
        printf("%d %d\n", gcd(max, min), lcm(max, min));
    }
    return 0;
}

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

int main() {
	long long int a, b, t, aa, bb;

	while (!cin.eof()) {
		cin>>a;
		cin>>b;

		aa = a;
		bb = b;

		while (1) {
			if (b==0) break;

			t = b;
			b = a % b;
			a = t;
		}
		cout<<a<<" "<<aa*bb/a<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int i;
		if(a>=b)
			i=b;
		else
			i=a;
		while(true){
			if(a%i==0&&b%i==0)
				break;
			i--;
		}
		int keep=i;
		cout<<i<<" ";
		if(a>=b)
			i=a;
		else
			i=b;
		while(true){
			if(i%a==0&&i%b==0)
				break;
			i+=keep;
		}
		cout<<i<<endl;
	}
	return 0;
}