Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

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

int gcd(int a,int b) {
	int r;
	while (1) {
	
			r = a%b;
			if (r == 0) {
				break;
			}
			a = b;
			b = r;	
	}
	return b;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		int c;
		c = gcd(a, b);
		int d, e;
		d = a / c;
		e = b / c;
		int lcm = d*e*c;
		cout << c << " " << lcm << endl;
	}
	return 0;
}

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<3;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a/gcj*b;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
printf("%d %d\n",lcm, gcd);
    //std::cout << gcd << " " << gcd << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

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

C++: #include <algorithm>
#include <sstream>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;

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

	return gcd(b, a % b);
}

int main()
{
	long long int a, b, x;
	while (cin >> a >> b && a != EOF) {
		x = gcd(a, b);
		cout << x << " " << a * b / x << endl;
	}
}

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

int main(){
  long a, b;
  long ca, cb, tmp;
  long gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb!=0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a/gcd*b;

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

  return 0;
}

C++: // 2012/11/07 Tazoe

#include <iostream>
using namespace std;

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

	return gcd(b, a%b);
}

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

		if(cin.eof())
			break;

		int g = gcd(a, b);
		cout << g << ' ' << a/g*b << endl;
	}

	return 0;
}

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

int GCD(int value1,int value2){
    int large,small;
    
    if(value1>=value2){
        large=value1;
        small=value2;
    }else{
        large=value2;
        small=value1;
    }
    
    if((large-small)==0){
        return large;
    }else{
        return GCD(small,large-small);
    }
}

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

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


int yukurid(long long int, long long int);

int main()
{
	long long int a, b, tmp;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%lld %lld\n", yukurid(a, b),((a*b)/yukurid(a,b)));
	}
	return 0;

}

int yukurid(long long int a, long long int b)
{
	long long int tmp;
	if (a%b == 0)return b;
	else
	{
		tmp = a;
		a = b;
		b = tmp%b;
		return yukurid(a, b);
	}
}

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

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

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

C++: #include <iostream>

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

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

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

long gcd(long a, long b) {

    if ( a < b ) {
        long t = b;
        b = a;
        a = t;
    }

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

}

int main() {

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

        long g = gcd(a, b);
        cout << g << " " << (a * b / g) << endl;
    }
     
    return 0;
}

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

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a);
}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int a,b;
int gcd(int a,int b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
int main()
{
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        int x=gcd(a,b);
        int y=a/x*b;
        printf("%d %d\n",x,y);
    }
}

C++: #include<iostream>

using namespace std;

int main(){
	int a,b,ta,tb,tc;
	while(1){
		cin >> a>>b;
		if(!a && !b)break;
		ta=a;
		tb=b;
		while(1){
			if(ta<tb){
				tc=ta;
				ta=tb;
				tb=tc;
			}
			tc=ta%tb;
			if(tc==0)break;
			ta=tb;
			tb=tc;
		}
		cout << tb<< " "<< a*b/tb <<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,x;
    cin >> a >> b;
    c=a*b;
    if(a>=b){
        x=a;
        a=b;
        b=x%b;
    }
    else if(a<b){
        b=a%b;
    }
    while(b!=0){
        x=a;
        a=b;
        b=x%b;
    }
    cout << a << " " << c/a << endl;
}

C++: #include<stdio.h>
int main(void){
  int a,b,i=1,ans1,ans2,ans3,j;
  
  while(scanf("%d %d",&a,&b)!=EOF){
    ans2=i*a;
    ans3=i*b;
      i=1;
      if(a>b){
      while(ans2!=ans3){
	ans2=i*a;
	for(j=i;ans2>ans3;j++){
	  ans3=b*j;  
	}
	i++;
      }
      printf("%d %d\n",a*b/ans3,ans3); 
      }
  

    else if(b>a){
      i=1;
      while(ans3!=ans2){
	ans3=i*b;
	for(j=i;ans3>ans2;j++){
	  ans2=a*j;  
	}
	i++;
      }
      printf("%d %d\n",a*b/ans2,ans2);
    }

    else{
      printf("%d %d\n",a,a);   
    }
  }
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
	int a,b,a1,b1,c;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		if(a<b)
		{
			a1=b;
			b1=a;
		}
		else
		{
			a1=a;
			b1=b;
		}
		while(1)
		{
			r=a1%b1;
			if(r==0)
				break;
			else
			{
				a1=b1;
				b1=r;
			}
		}
		cout<<r<<" "<<a*b/r<<endl;
	}	
	return 0;
}

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

using namespace std;

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