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 <stdio.h>

int main(){
    float a[20],b[20];
    int nCount = 0;
    while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){
        nCount++;
    }

    for( int k = 0;k < nCount;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
 
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

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

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

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

int main()
{
	unsigned long a, b;
	while (std::cin >> a >> b) {
		std::cout << gcd(a, b) << " " << lcm(a, b) << "\n";
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
	long long int a, b, c=1, d=1, m, i;
	while (cin >> a >> b) {
		for (i = 0;i < b;i++) {
			for (m = 0;m < a;m++) {
				if (a*(i + 1) == b*(m + 1)) {
					c = a*(i + 1);
					i = -1;
					break;
				}
			}
			if (i == -1) { break; }
		}
		if(a > b){
			for (i = a;i > 0;i--) {
				if (a%i == 0 && b%i == 0) { break; }
			}
		}else{
			for (i = b;i > 0;i--) {
				if (b%i == 0 && a%i == 0) { break; }
			}
		}
		d = i;
		cout << d << ' ' << c << endl;
	} 
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;


    long long g(int a,int b){

	int r=max(a,b)%min(a,b);
	if(r==0)  return min(a,b);
	else return g(min(a,b),r);
}

int main(){

	long long a,b;
	cin >> a >> b;

	cout << g(a,b) << " " << (a*b)/g(a,b) << endl;


	return 0;
}

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

int gcd(int a, int b)
{int p,q,r;if(a<b){p=b;b=a;a=p;}    
while(r!=0){    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<cstdio>
#include<iostream>
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 (scanf("%d%d", &a, &b) != EOF){
		cout << gcd(a, b) << " ";
		cout << lcm(a, b) << endl;
	}
	//system("pause");
	return 0;
}

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

long long int num[1000][2];
int t;

void gcdlcm(int n, int m){
	long long int a, b;
	a = n;
	b = m;
	for(int i = 0; i < 1000; i++){
		if(n % m == 0){
			num[t][0] = m;
			num[t][1] = a*b/m;
			break;
		}
		else{
			n = n - (n/m)*m;
			swap(n, m);
		}
	}		
}
int main(){
	int a, b;
	t = 0;
	while(cin >> a >> b){
		gcdlcm(a, b);
		t++;
	}
	for(int i = 0; i < t; i++){
		cout << num[i][0] << " " << num[i][1] << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
    int a,b,lcm=0,count=0;
    while(cin>>a>>b){
        count++;
        if(count>50)break;
    for(int k=a;k>=1;k--){
        if(a%k==0&&b%k==0) {
            lcm=k;
            break;
        }
    }
    cout<<lcm<<" "<<a*b/lcm<<endl;
}
}

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

int main()
{
ll a , b;
while(cin >> a >> b)
cout << __gcd(a , b) << " " << a*b/__gcd(a , b) << endl;
return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <algorithm>

typedef long long int lli;
#define PI 3.1415926535897932
#define MAX(a,b) ((a>b)?(a):(b)) // ?????§????????????
#define MIN(a,b) ((a<b)?(a):(b)) // ????°?????????????
#define INRANGE(a,b,c) ((a<=b&&b<=c)?(1):(0)) // a<=b<=c??????????????????????????????

int zeller(int y,int m,int d){ // ?????§??????
	if(m<3){y--; m+=12;}
	return (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
}

lli gcd(lli a,lli b){	// ?????§??¬?´???°
	if(b==0) return a;
	return gcd(b,a%b);
}

lli lcm(lli a,lli b){	// ????°???¬?????°
	return a*b/gcd(a,b);
}

int main(void){
	lli a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

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

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

int func2(const int a,const int b){
    int a2=a,b2=b;
    while(a2 != b2){
        if(a2>b2)b2+=b;
        else a2+=a;
    }
    return a2;
}

int main(){
    int a,b;
    while(cin >> a >> b){
        cout << func1(a,b) << " " << func2(a,b);
    }
    return 0;
}

C++: #include <stdio.h>
typedef long long lint;
int a,b;
int gcd(int a,int b) {
    if(b==0) return a;
    return gcd(b,a%b);
}
int main() {
#ifdef debug
    freopen("in.txt","r",stdin);
#endif
    int g;
    while(scanf("%d %d",&a,&b)!=EOF) {
        g=gcd(a,b);
        printf("%d %lld\n",g,(lint)a*b/g);
    }
}

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


int main(){
	int a, b, tmp, x, y, z;
	while (true){
		cin >> a >> b;
		if (cin.eof()){
			break;
		}
		if (a < b){
			 tmp = a;
			 x = b;
		}
		else {
			x = a;
			tmp = b;
		}
		while (tmp != 0) {
			y = tmp;
			tmp = x % y;
			x = y;
		}
		z = a / y * b;
		cout << to_string(y) << " " << to_string(z) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int p,int q){
  int s;
  while(q){
    p%=q;
    s=p;
    p=q;
    q=s;
  }
  return p;
}
int main(){
  int g,p,q;
  while(cin>>p>>q){
    g=gcd(p,q);
    cout<<g<<" "<<p/g*q<<endl;
  }
  return 0;
}

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=1;i<min(a, b);i++){
    if(a%i==0 && b%i==0){
      max = i;
    }
  }
  return max;
}

int find_LCM(int a, int b){
  int LCM;
  for(int i = max(a, b)+1;;i++){
    if(i%a==0 && i%b==0){
      LCM = i;
      break;
    }
  }

  return LCM;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
        cout << find_GCD(a, b) << " " << find_LCM(a, b) << endl;
  }

}

C++: #include <iostream>

template <typename T> T gcd(T a, T b) {
	T r;

	while (b) {
		r = a % b;
		a = b;
		b = r;
	}

	return a;
}

template <typename T> T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

int main() {
	using namespace std;
	for (;;) {
		int a, b;
		cin >> a >> b;
		if (cin.eof()) { break; }

		int g = gcd(a, b);
		int l = lcm(a, b);
		cout << g << ' ' << l << endl;
	}
	return 0;
}

C++: #include <iostream>
 
//calc G.C.D(m >= n)
int calcGcd(int m, int n){
    return n == 0 ? m : calcGcd(n, m%n);
}
//calc L.C.M
inline int calcLcm(int m, int n, int gcd){
    return m / gcd * n;
}

int main(){
	
    int a, b;
    // input
    while(std::cin >> a >> b){
        int gcd, lcm;
         
        if(a > b) gcd = calcGcd(a, b);
        else gcd = calcGcd(b, a);
        lcm = calcLcm(a, b, gcd);
        // output
        std::cout << gcd << " " << lcm << std::endl;
    }
     
    return 0;
}