Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

int saidai(int a,int b){
	while(a !=b){
		if(a>b){
			a -=b;
		}
		else{
			b -=a;
		}
	}
	return a;
}

int saisyou(int a,int b){
	return a*b/saidai(a,b);
}


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

	c=saidai(a,b);
	d=saisyou(a,b);
	cout<<c<<" "<<d;
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n,a,s,i,d,c,j,x,g,w,z,m;
	while(scanf("%d %d",&a,&s)!=EOF){
		w=a; z=s;
		if(a==0&&s==0) break;
		if(a<s){
			n=a;
			a=s;
			s=n;
		}
		while(s!=0){
			a=a%s;
			g=a;
			a=s;
			s=g;
		}
		m=(w/a)*(z/a)*a;
		printf("%d %d\n",a,m);	
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd, lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 1;;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		printf("%d %d\n",gcd, lcm);
	}
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <cstdlib>
using namespace std;

// 一行取って、一番初めのTを習得
template <class T> int streamvar(std::istream& in, T& var)
{
    string s;
    if (!in) {
        return 1;
    }
    getline(in, s);
    istringstream is(s);
    is >> var;
    if (is.fail()) 
        return 1;
    return 0;
}
// 一行取って、T vectorに格納する
template <class T> int streamvec(std::istream& in, std::vector<T> &v)
{
    v.clear();
    string s;

    if (!in) 
        return 1;
    getline(in, s);
    if (in.fail()) 
        return 1;
    istringstream is(s);
    while (1) {
        T tmp;
        is >> tmp;
        if (is.fail())
            break;
        v.push_back(tmp);
    }
    return 0;
}

long long gcd(long long a, long long b)
{
    if (!b) return a;
    return gcd(b, a % b);
}

int main(void)
{
    vector<int> v;
    while (!streamvec(cin, v)) {
        cout << gcd(v[0], v[1]) << " " << (long long)v[0] / gcd(v[0], v[1]) * v[1] << endl;
    }
    return 0;
}

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

int gcd (int a, int b)
{
    if (b == 0){
        return (b);
    }
    else {
        gcd(b, a % b);
    }
}
int lcm(int a, int b)
{
    while (1){
        int i = 2;
        if (a % i == 0 && b % i == 0){
            return (i);
            break;
        }
        i++;
    }
}

int main()
{
    int a, b;

    cin >> a;
    cin >> b;
  
 

    cout << gcd(a, b) << " " << lcm(a, b) << endl;
    return (0);
}

C++: 
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <functional>
#include <string.h>
#include <cmath>

using namespace std;

int gcd(int a, int b)
{
    while(b){
        a %= b;
        a ^= b ^= a ^= b;
    }
    return a;
}

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

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

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

		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			if (b == 0){
				printf("0 ");
				break;
			}

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		if (b == 0){
			printf("%d\n", a);
		}

		m = a / b;/*/公倍数*/
		m *= B;
		printf("%d\n",m); 
	}

	return 0;
}

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

long long gcd (long long a, long long b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%ld", &a) != EOF) {
    scanf("%ld", &b);
    long long g = gcd(a, b);
    printf("%ld %.3lf\n", g, a * b / g);

  }

  return 0;
}

C++: #include <stdio.h>

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

int main(){
  int a,b;
  scanf("%d%d",&a,&b);
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);


  return 0;
}

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

using namespace std;

typedef long long ll;

double xx(double r) {
  return r*r;
}

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

int main() {
  ll a, b;
  while ( scanf("%lld%lld", &a, &b) != EOF ) {
    ll g = gcd(a, b);
    ll l = a / g * b;
    cout << g << " " << l << endl;
  }
}

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
//辗转相除 
int gcd(int a, int b) {
	if(b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

int main()
{
	int a, b;
	while(cin >> a >> b) {
		
		int a1 = max(a, b);
		int b1 = min(a, b);
		int res1 = gcd(a, b);					//最大公约数 
		long long t = (long long)a * b;		//t可能会超int范围(没有尝试) 
		long long res2 = t / res1;			//最小公倍数 
		cout << res1 << " " << res2 << endl;
		
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
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)<<endl;
	return 0;
}

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

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 / gcd(num1, num2) * num2;
}

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

C++: #include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
long long gcd(long long a,long long b)
{
    if(b) return gcd(b,a%b);
    return a;
}
int main()
{
    long long a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF)
    {
        long long ans=gcd(a,b);
        long long ans1=a*b/ans;
        printf("%lld %lld\n",ans,ans1);
    }
    return 0;
}

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

int g,l;
double a,b,d;

int main()
	{

	while( cin >> a >> b )
		{
			d = a*b;
			while( a != b)
				{
					if( a>b ){ a = a-b; }
					else if( b>a ){ b = b-a; }
				}
				g = (int)a;
				l =  (int)(d/g);
				cout << g <<" "<< l << endl;
		}
		return 0;
	}

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

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

int main(){
    int m,n;
    //long p;
    int k;
    while(cin>>m>>n){
        //p=m*n;
        k=Gcd(m,n);
        cout<<k<<" "<<m/k*n<<endl;
    }
}

C++: #include <iostream>
int GCD(int a, int b) {
 while (b!=0) {
  int r = a%b;
  a = b;
  b = r;
 }
 return a;
}
int main() {
 int a,b;
 while (std::cin>>a>>b) {
  int gcd = GCD(a,b);
  int lcm = a*b/gcd;
  std::cout << gcd << ' ' << lcm << std::endl;
 }
 return 0;
}