Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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

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

    int max = max(a,b);
    int min = min(a,b);

    int gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j;
        break;
      }
      else{ 
        i++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

C++: #include <iostream>
using namespace std;
long long MaxDivisor(long long a, long long b);
long long MinMultiple(long long a, long long b);
int main()
{
	long long m, n;
	while (cin >> m >> n) {
		cout << MaxDivisor(m, n) << " " 
			<< MinMultiple(m, n) << endl;
	}

	//system("pause");
	return 0;
}
///??相除法求最大公?数
long long MaxDivisor(long long a, long long b) {
	long long temp, r;
	if (a < b) {
		temp = a;
		a = b;
		b = temp;
	}
	r = a % b;
	while (0 != r) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
long long MinMultiple(long long a, long long b) {
	return (a * b / MaxDivisor(a, b));
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
main()
{
	while(1)
	{
	
	long a,b,c,d,num;
	
	while(scanf("%d%d",&a,&b)!=EOF)
	{ 
	
	   
	
	num=a*b;
	
	for(;b!=0;)
    {
    	c=a%b;
    	a=b;
    	b=c;
	}
	d=num/a;
	cout<<a<<" "<<d<<endl;
}	
    } 
 }

C++: #include<cstdio>

int main(){
	long long a,b,g,l,t;
	while(scanf("%d %d", &a, &b) + 1){
		if(a > b){
			t = a;
			a = b;
			b = t;
		}

		if(b % a){
			t = a / 2;
			for(int i = 2; i <= t; i++){
				if(!(a % i)){
					g = a / i;
					if(!(b % g)){
						printf("%lld %lld\n", g, a * b / g);
						i += t;
					}
				}
			}
		}else{
			printf("%lld %lld\n", a, b);
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
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 lcm( int m, int n )
{
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	return ((m / gcd(m, n)) * n);
}
int main(){
	int a,b,i,j,t;
	while(scanf("%d%d",&a,&b)!=EOF){
		cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
	}
return 0;
}

C++: #include<iostream>

int gcd(int x, int y){
	if (y == 0)return x;
	return gcd(y, x%y);
}

int main(){
	int a, b;
	while (std::cin >> a >> b){
		int tmp = gcd(a, b);
		std::cout << tmp << " " << a / tmp*b << std::endl;
	}
	return 0;
}

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

int main()
{
	long int a,b,i,min,max,x,y; //x最大公約数 y最小公倍数

	while(cin>>a>>b){
		x=y=0;
		if(a<b){
			min=a; max=b;
		}else{
			max=a; min=b;
		}

		for(i=min,x=0; x==0; i--){
			if(a%i==0 && b%i==0) x=i;
		}
		for(i=max,y=0; y==0; i+=max){
			if(i%a==0 && i%b==0) y=i;
		}

		cout<<x<<" "<<y<<endl;
	}
}

C++: //先辗转相除找gcd再通过gcd求lcm
#include <bits/stdc++.h>

using namespace std;

long long a,b;

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

int main()
{
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		long long yin=gcd(a,b);
		printf("%I64d ",yin);
		long long ax=a/yin,bx=b/yin;
		printf("%I64d\n",ax*bx*yin);
	}
	return 0;
}

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

using namespace std;

int main()
{
    int a,b;

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

        int less=(a<b)? a:b;
        int greater=(a<b)? b:a;

        for(int i=2;i<=greater;i++){
            if((a%i==0)&&(b%i==0)) gcd=i;
        }

        for(int i=greater;i<=2000000000;i++){
            if((i%a==0)&&(i%b)==0){
                lcm=i;
                break;
            }
        }

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

    return 0;
}

C++: #include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
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){
        if(a<b)swap(a,b);
        int g=gcd(a,b);
        cout<<g<<a/g*b<<endl;
    }
}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

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

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

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			swap(a, b);
		}

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

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

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

int main(){
    double a,b;

    while(cin>>a>>b){
        cout<<gcd(a,b)<<" "<<a / gcd(a,b) * b <<endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
  long long int x, y;
  while(cin >> x >> y) {
    if (x < y) swap(x, y);
    long long int X = x, Y = y;
    while(1) {
      x %= y;
      swap(x, y);
      if(y == 0) break;
    }
    cout << x << ' ' << X * Y / x << endl;
  }
}

C++: #include<iostream>
using namespace std;
main()
{
	while(1)
	{
	
	long long a,b,c,d,num1,num2;
	
	cin>>a;
	if(a==EOF)
	   break;
	cin>>b;
	num1=a;num2=b;
	
	for(;b!=0;)
    {
    	c=a%b;
    	a=b;
    	b=c;
	}
	d=num1*num2/a;
	cout<<a<<" "<<d<<endl;
	
    } 
 }

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;

long long int gcd(long long int m,long long int n){
	if(m==0||n==0){
		return 0;
	}
	while(true){
		if(m>n){
			m %=n;
			if(m==0){
				return n;
			}
		}
		else{
			n %=m;
			if(n==0){
				return m;
			}
		}

	}
}
long long int lcm(long long int m,long long int n){
	if(m==0||n==0){
		return 0;		
	}
	else{
		return ((m/gcd(m,n))*n);
	}
}

int main() {
	long long int a,b,G,L;
	while(true){
		cin>>a>>b;
		if (cin.eof())break;
		G=gcd(a,b);
		L=lcm(a,b);
		cout<<G<<" "<<L<<endl;
	}
}

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

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

int main(){
	long a,b;
	while(!cin.eof()){
		cin >> a >> b;
		long g = gcd(a,b);
		cout << g << " " << a*(b/g) << endl;
	}
	return 0;
}