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 <stdio.h>
 
using namespace std;
 
int calcMax(int a,int b){
    int tmp;
    if(a > b){
        while(b != 0){
            tmp = b;
            b = a%b;
            a = tmp;
        }
        return a;
    }else{
        while(a != 0){
            tmp = a;
            a = b%a;
            b = tmp;
        }
        return b;
    }
}
 
 
 
int calcMin(int a,int b){
    int max_common = calcMax(a,b);
    return (a/max_common)*b;
}
 
int main(){
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF){
        printf("%d %d\n",calcMax(a,b),calcMin(a,b));
    }
 
    return 0;
}

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

int main(){
    int a, b, lcm, gcd;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			if(_b % _a == 0){
				gcd = _a;
				break;
			}
			_a = _a % _b;
			std::swap(_a, _b);
		}
		lcm = a / gcd * b;
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: 
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
int main()
{
	long long a, b;
	while (cin >> a >> b)
	{
		int A, B;
		A = saisho(a,b);
		B = saidai(a, b);
		cout << A << " " << B<<endl;
	}
	return 0;

}
int saidai(int N, int M)
{
	int n = N, m = M;

	int s = 1;
	while (true)
	{
		if ((s*n) % m == 0)
		{
			break;
		}
		else { s++; }
	}
	return s*n;
}

int saisho(int N, int M)
{
	int n = N, m = M;
	while (true)
	{
		if (n == 0) { return m; break; }
		if (m == 0) { return n; break; }
		if (n > m) { n -= m; }
		else { m -= n; }
	}
}

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

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

int main(){
	int a,b;
	while(cin>>a>>b){
		int a2=a;
		int b2=b;
		while(true){
			if(a>b){
				a=a%b;
			}else{
				b=b%a;
			}
			if(a==0||b==0)break;
		}
	cout<<max(a,b)<<" "<<a2/max(a,b)*b2<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
using namespace std;

int main() {
	
	int a, b;
	int lcm, gcd;
	for (int j = 0;j < 50;j++) {
		cin >> a >> b;
		int i = 2;
		lcm = 1;
		while (i <= a && i <= b) {
			if (a % i == 0 && b % i == 0) {
				lcm *= i;
				a /= i;
				b /= i;
			}
			else i++;
		}
		printf("%d %d\n", lcm, a * b * lcm);
	}

	//system("pause");
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int a,b,big,small,r;

    while(1){
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        
        if(a > b){
            big = a;
            small = b;
        }
        else {
            big = b;
            small = a;
        }
        
        r = big % small;
        while(r != 0){
            big = small;
            small = r;
            r = big % small;
        }
        
    }
    
    cout << small << ' ' << (a / small) * (b / small) * small << endl; 

    return 0;
}

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

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

 GCD(b, a%b);
}

int LCM(int a, int b)
{
 int c = GCD(a, b);

 return a*b/c;
}

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

 cout << GCD(a, b) << ' ' << LCM(a, b) << '\n';

 return 0;
}

C++: 
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
    
#define ll (long long)
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)


using namespace std;


int main(void)
{
    
    int  number1, number2;
    long long answer2 = 0; int answer1;
    int temp;
    int i;
    long long answer2array[1000] = {1};
    int answer1array[1000] = {0};
    int counter = 0;
    
    while(cin >> number1 >> number2)
    {
        /*?????§??¬?´???°???????±???????*/
        int x = 0, y = 0, x2 = 0, x1 = 0;
        if(number1 > number2)
        {
            x = number1;
            y = number2;
            x1 = x;
            x2  = y;
        }
        else
        {
            x = number2;
            y = number1;
            x1 = x;
            x2 = y;
            
        }
        while(x % y)
        {
            temp = (x % y);
            x = y;
            y = temp;
        }
        answer1 = y;
        /*????°???¬?????°????±???????*/
        for(i = 1;i<=x2;i++)
        {
            if((x1*i)%x2 == 0)
            {
                answer2 = (long long)(x1*i);
                break;
            }
        }
        
        answer2array[counter] = answer2;
        answer1array[counter] = answer1;
        counter++;
        }
        REP(i, counter)
    cout << answer1array[i] << " " << answer2array[i] << endl;
    return 0;
    

    }

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    long long int a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        printf("%lld %lld\n",__gcd(a,b),a/__gcd(a,b)*b);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,i;
while(cin>>a>>b){
int max=0,min;
i=1;
while(r!=0){
r=x%y;
x=y;
y=r;
}
max=x;
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}

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

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

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

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

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

int main()
{
	int a,b;
	while(true){
		cin >> a;
		if(cin.eof())
			break;
		cin >> b;

		int a1=0,b1=0;
		a1=a;
		b1=b;

		int sum=0;
		while(a1%b1!=0){
			sum = b1;
			b1 = a1%b1;
			a1 = sum;
		}

		int g=0,m=0;
		g=b1;
		m=a/g*b;

		cout << g << ' ' << m << endl;
	}
	return 0;
}

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

C++: #include <cstdlib>
#include <iostream>
#include <iomanip>
#include <stdio.h>

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);

    long a,b,c,d;
    while (std::cin >> a >> b) {
        if (a > b){
            c = a;
            d = b;
        }else{
            c = b;
            d = a;
        }
        long temp;
        while (c % d != 0){
            temp = d;
            d = c % d;
            c = temp;
        }
        std::cout << d << " " << a*b/d << std::endl;
    }
    return EXIT_SUCCESS;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int lcm( int a, int b )
{
	int temp = __gcd( a, b );

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