Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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

int Func_gcd(int num1, int num2){
	int surplus;
	
	while((surplus=num1%num2) != 0){
		num1 = num2;
		num2 = surplus;
	}
	
	return num2;
}

int main()
{
	int gcd, lcm;
	int num1, num2;
	
	while(cin>>num1>>num2){
		gcd = Func_gcd(num1, num2);
		lcm = (num1*num2)/gcd;
				
		cout << gcd << " " << lcm << "\n";
	}
	
	return 0;
}

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

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 <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    while(cin >> a >> b) {
        int g = __gcd(a, b);
        cout << g << ' ' << a / g * b << endl;
    }
}

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

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		long int minmul = a * b; //least common multiple
		u_int maxdivi = 1; //greatest common divisor

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = minmul / maxdivi;

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	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;
    while(scanf("%d%d", &a, &b) != EOF)
        printf("%d %d\n", gcd(a, b), a / gcd(a, b) * b);
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(i=0;i<=50;++i{
  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;
if(x==1){cout<<y<<" "<<y<<endl;}
else{cout<<y<<" "<<L<<endl;}
}
  return 0;
}

C++: #include <iostream>

int main() {
	long long int a, b;
	while( std::cin >> a >> b ) {
		long long int m = ( a >= b ) ? a : b, n = ( a >= b ) ? b : a;
		while( n != 0 ) {
			long long int r = m % n;
			m=n; n=r;
		}
		std::cout << m << " ";
		long long int l = a * b / m;
		std::cout << l << std::endl;
	}
}

C++: #include<stdio.h>
int main(){
  long long int a,b,n,i,j;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    if(a>=b){
      n=b;
    }
    else{
      n=a;
    }
    i=a;
    j=b;

    while(1){
      /*   if(n<a){
	n=a%n;
      if(n==0){
	n=a;
	break;
      }
      }
      else if(n<b){
	n=b%n;
      if(n==0){
	n=b;
	break;
      }
      }*/

      n=a%b;
      if(n==0){
	n=b;
	break;
      }else{
	a=b;
	b=n;
      }

    }
    /*
    while(1){
      if(a*i==b*j){
	break;
      }
      else if(a*i<b*j){
	i++;
      }
     else if(a*i>b*j){
	j++;
	   }
	   }*/

    printf("%lld %.0f\n",n,(double)(i)*(double)(j)/(double)(n));
  }
  return (0);
}

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

int max(int a, int b){
    int c;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    while(a != b){
        if(a > b){
            a = a - b;
        }else{
            b = b - a;
        }
    }
    
    return a;
}

int min(int a, int b){
    int d;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    d = a * b / max(a, b);
    
    return d;
}

int main()
{
    int a, b;
    
    while(cin >> a >> b){
        cout << max(a, b) << " " << min(a, b) << endl;
    } 
    
    return 0;
}

C++: 
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b){
        int x=a,y=b;
        while(true){
            if(x==y)
                break;
            if(x>y)
                x-=y;
            else if(y>x)
                y-=x;
        }
        cout<<x<<" ";
        int keep=x;
        x=a/keep;
        y=b/keep;
        cout<<x*y*keep<<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", lcm(max, min), gcd(max, min));
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

long long calcGCD(long long a, long long b) {
	long long result = 0;

	while(result == 0) {
		if(a > b){
			a = a % b;
			if (a == 0) {
				result = b;
			}
		}
		else {
			b = b % a;
			if (b == 0) {
				result = a;
			}
		}
	} 
	return result;
}

int main() {
	long long a, b;

	while (cin >> a >> b) {

		long long gcd = calcGCD(a, b);
		long long lcm = a * b / gcd;

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

C++: #include <stdio.h>

#define REP(i, n) for(i=0;i<n;i++)
#define MOD_NUM (1000000007)

int main(void)
{
	int a, b;
	int gcd;
	long long int lcm;

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

		gcd = 1;
		for (i = 2; i <= a && i <= b; i++){
			if (a % i == 0 && b % i == 0){
				gcd *= i;

				a /= i;
				b /= i;
				i--;
			}
		}
		lcm = gcd * a * b;

		printf("%d %lld\n", gcd, lcm);
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int calc_gcd(int a, int b) {
        int bigger = a > b ? a : b;
        int lower = a > b ? b : a;

        int r = a % b;
        while (r != 0) {
                a = b;
                b = r;
                r = a % b;
        }

        return b;
}

int calc_lcm(int a, int b) {
        int bigger = a > b ? a : b;
        int lower = a > b ? b : a;

        int ans = bigger;
        while((ans % lower) != 0) {
                ans = ans + bigger;
        }

        return ans;
}

int main(void) {
        int a,b;

        while(cin >> a >> b) {
                cout << calc_gcd(a,b);
                cout << " ";
                cout << calc_lcm(a,b);
                cout << endl;
        }

        return 0;
}

C++: #include <iostream>
using namespace std;
float LCM(float a,float b)
{
	if(a==b)
	return a;
	else
	{
		if(a>b)
		a-=b;
		else
		b-=a;
		LCM(a,b);
	}
}
int main()
{
	float a,b;
	long c;
	while(cin>>a>>b)
	{
		c=LCM(a,b);
		if(c>100000)
			cout<<c/10000<<"0000 "<<(a*b/c)/10000<<"0000"<<endl;
		else if((a*b/c)>100000)
			cout<<c<<" "<<(a*b/c)/10000<<"0000"<<endl;
		else
			cout<<c<<" "<<(a*b/c)<<endl;
	}
}

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

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return(a);
}

int main(){
    int data0,data1;
    int answer;
    while(cin>>data0>>data1){
        answer=gcd(data0,data1);
        cout<<answer<<" "<<data0*data1/answer<<endl;
    }
}

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

int main(int argc, char *argv[]){
    int a,b,r;
	while(cin>>a>>b){
		int a0=a,b0=b;
		r=a%b;
		while(r!=0){
			a=b;
			b=r;
			r=a%b;
		}
	    
		cout <<b<<" "<< a0*(b0/b) << endl;
	}
    return 0;
}

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

int main(){
	long a,b,m,n,tmp;
	
	while(cin>>a>>b){
		if(a>=b){
			m=a;
			n=b;
		}else{
			m=b;
			n=a;
		}
		
		for(;n!=0;){
			tmp=n;
			n=m%n;
			m=tmp;
		}
		
		cout<<m<<" "<<a*b/m<<endl;
	}
	return 0;
}