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 <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (; i <= minimum; i++) {
            if (a % (minimum - i + 2) == 0 && b % (minimum - i + 2) == 0) {
                i = minimum - i + 2;
                break;
            } else if (i == minimum) {
                i = 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: #include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


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

  return 0;
}

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

int main() {
    
    int a,b;
    while(cin >> a >> b){
        for(int i = a;i > 1;i--){
            if(b%i == 0 && a%i == 0){
                cout << i << "\n";
                break;
            }
        }
        for(int i = a;i < 2000000000;i++){
            if(i%a == 0 && i%b == 0){
                cout << i << "\n";
                break;
            }
        }
    }
    
return 0;
}

C++: #include <bits/stdc++.h>

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 c = gcd(a, b);
        cout << c << " " << a/c*b << endl;
    }
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
class GCDandLCM{
    public:
        void solve(long a,long b){
            long big=a,small=b;
            if(a<b){ 
                big=b;
                small=a;
                int tmp=a;
                a=b;
                b=tmp;
            }
            while(big%small!=0){ 
                int tmp=big%small;
                big=small;
                small=tmp;
            }
            printf("%ld %ld\n",small,(a*b)/small);
        }
};
int main(){ 
    GCDandLCM inst;
    long a,b;
    while(cin>>a>>b){ 
        inst.solve(a,b);
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>
typedef unsigned long long int ll;

using namespace std;

ll Euclid(ll m, ll n){
    if(n == 0)  return m;
    else        return Euclid(n, m % n);
}

int main(){
    ll gcd;    //the greatest common divisor
    ll lcm;    //least common multiple
    ll m, n, tmp;
    while (cin >> m >> n){
        if(m < n){
            tmp = m;
            m = n;
            n = tmp;
        }
        gcd = Euclid(m, n);
        lcm = m * n / gcd;
        cout << gcd << " " << lcm << endl;
    }
	return 0;
}

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

C++: #include <iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF){

        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
    
    
    
    
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
main(){
	int n1,n2,a1,a2;
	while(cin>>n1>>n2){
		int mx=max(n1,n2);
		for(int i=mx;i>0;--i){
			if(n1%i==0 && n2%i==0){
				a1=i;
				break;
			}
		}
		a2=(n1/a1)*n2;
		cout<<a1<<" "<<a2<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		long long a, b;
		cin >> a >> b;
		if ( cin.eof() )
			break;

		long long x = max(a,b);
		long long y = min(a,b);

		while ( y > 0 )
		{
			x -= y;
			if ( x < y )
				swap( x, y );
		}

		long long gcd = x;
		long long lcm = a*b / gcd;

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

	}
	return 0;
}

C++: #include <bits/stdc++.h>
#include<math.h>
using  namespace std;
#define ll    long long int
#define pai     pair<int,int>
#define vi      vector<int>
#define vd      vector<double>
#define mpi     map<int,int>
#define mps     map<string,int>
#define sti     stack<int>
#define stc     stack<char>
#define sei     set<int>
#define ses     set<string>
#define multii  multiset<int>

ll gcd(ll a,ll b){
if(b==0){
    return a;
}
else{
   return gcd(b,a%b);
}
}
 int main()
{
  /*#ifndef ONLINE_JUDGE
  freopen("tin.txt","r",stdin);
  freopen("tout.txt","w",stdout);
  #endif*/

ll a,b;
while(cin>>a>>b){

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


}
}

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

unsigned int gcd(const unsigned int a, const unsigned int b) {
	unsigned int result = 1;

	for (unsigned int k = 1; k <= a and k <= b; k++) {
		if (a % k == 0 and b % k == 0) { result = k; }
	}

	return result;
}

unsigned int lcm(unsigned int a, unsigned int b) {
	unsigned int mult;

	if (a > b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}

	for (unsigned int k = 1; k <= a; k++) {
		mult = b * k;
		if (mult % a == 0) { return mult; }
	}

	return 0;
}

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

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

unsigned long long int GCD();

int main(void){
	while(1){
		unsigned long long int a, b, gcd, lcm, temp;
		if( a < b){
			temp = a;
			a = b;
			b = temp;
		}
		cin >> a >> b;
		if(a == 0 || b == 0)
			return 0;
		gcd = GCD(a,b);
		lcm = a * b / gcd;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

unsigned long long int GCD(unsinged long long int a, b){
	if(a % b == 0)
		return (b);
	else
		return (GCD(b, a%b);
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <functional>
#include <iomanip>
using namespace std;

#define ll long long int

#define rep(p,q) for(int i = p; i < q;i++)

int gcd(ll a, ll b) {
	if (a < b) {
		ll swap = a;
		a = b;
		b = swap;
	}
	int c = a % b;
	if (c == 0) return b;
	else gcd(b, c);
}

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

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){

	long int a, b;
	long int f;
	long int G, L, temp;

	while(cin >> a){
		cin >> b;
		f = a * b;
		if(a < b){
			temp = a;
			a = b;
			b = temp;
		}
		while(1){
			temp = a % b;
			if(temp==0) break;
			a = b;
			b = temp;
		}
		G = b;
		L = f/G;

		cout << G << ' ' << L << endl;
	}
	return 0;
}

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		int g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(l!=0)break;
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;
}