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>
using namespace std;

int main(){
   int a, b, tmp, m=0, s=0;
   while(cin >> a >> b){
      if(a<b){
         tmp=a;
         a=b;
         b=tmp;
      }
      while(1){
         if(a%b==0) m=b;
         else{
            a=a-b;
            tmp=a;
            a=b;
            b=tmp;
         }
      }
      s=a*b/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j),i){
		x=i,y=j;
		while((i!=0)&&(j!=0)){
			if(i>j){
				i=i%j;
			}else{
				j=j%i;
			}
		}
		if(i==0){
			y=x*y/j;
			x=j;
		}else{
			y=x*y/i;
			x=i;
		}
		printf("%lld %lld\n",x,y);
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
  
using namespace std;
  
int gcd(int a, int b){
    if(a%b==0) return b;
    return gcd(b, a%b);
}
  
unsigned long long lcm(int a, int b){
    return (a*b/gcd(a, b));
}
  
int a, b;
int main(){
    while(cin>> a>> b){
        if(a<b) swap(a, b);
        printf("%d %llu\n", gcd(a, b), lcm(a, b));
    }
}

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

unsigned long gcd(unsigned long a, unsigned long b){
	unsigned long q;
	while(q = a % b){
		a = b;
		b = q;
	}
	return b;
}

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

int main(){
	unsigned long a, b;
	while(scanf("%ld %ld", &a, &b)){
		printf("%ld %ld", gcd(a, b), lcm(a, b));
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	while(cin)
	{
		lld a,b;
		cin >> a >> b;
		lld n = min(a,b);
		lld m = max(a,b);
		lld gcd = 1;
		for(int i = 1; i <= n; i++)
		{
			if (n % i == 0 && m % i == 0)
			{
				gcd = i;
			}
		}
		cout << gcd << endl;
		cout << n * m / gcd << endl;
	}


	return 0;
}

C++: #include <cstdio>

unsigned long getGCD(unsigned long a, unsigned long b)
{
        if (!b) {
                return a;
        }

        return getGCD(b, a % b);
}

int main()
{
        unsigned long a, b;

        while (scanf("%lu %lu", &a, &b)) {
                unsigned long max = (a > b) ? a : b,
                                          min = (a < b) ? a : b;
                unsigned long gcd = getGCD(max, min);
                unsigned long lcm = a * b / gcd;
                printf("%lu %lu\n", gcd, lcm);
        }

        return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    int a,b, s;
    while(scanf("%d%d", &a, &b)!=EOF){
        s=__gcd(a, b);
        printf("%d %d\n", s, (a/s)*b);              
                        
    }  
    return 0;
}

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

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

int main()
{
	while(true){
		int a, b;
		cin >> a >> b;
		if(cin.eof()) break;
		int GCD = GetGCD(a, b);
		int LCM = a * (b / GCD);
		cout << GCD << ' ' << LCM << endl;
	}
	return 0;
}

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

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*b/__gcd(a,b));
    }

    return 0;
}

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

int main(){

	int a, b, j, tmp, gcd, lcm;
	
	while(cin >> a >> b){
	
		if(a > b){
			tmp = a;
			a = b;
			b = tmp;
		}
	
		gcd = a;
		for(int i=2;; i++){
			if(b % gcd == 0 || gcd == 1) break;
			else{
				for(j=i; a % j != 0; j++);
				gcd = a / j;
			}
		}
		
		lcm = b;
		for(int i=2;; i++){
			if(lcm % a == 0) break;
			else{
				lcm = b * i;
			}
		}
	
		cout << gcd << " " << lcm <<endl;
	
	}

	return 0;
}

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

using namespace std;

template <class T>
T gcd(T a, T b)
{
	if (b == 0)
		return a;
	return gcd(b, a%b);
}

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

	return 0;
}

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

C++: #include <iostream>

using namespace std;

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

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

C++: #include<bits/stdc++.h>
/*
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
*/
using namespace std;

typedef long long ll;

#define sqr(x) (x)*(x)
#define pb push_back
#define fst first
#define snd second

const ll mod=1000000007;
const int maxn=100005,maxm=505;
const double eps=1e-9;
const double pi=acos(-1.0);

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

ll a,b;

int main()
{
	int i,j,T;
	while(scanf("%lld %lld",&a,&b)!=EOF)
	{
		ll g=gcd(a,b);
		printf("%lld %lld\n",g,a/g*b);
	}
	return 0;
}

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

using namespace std;
int main()
{
	int  a, b,a1,b1,c,c1,g,l;
	cin >> a;
	cin >> b;
	a1 = a;
	b1 = b;
	
	while (1)
	{
		c1 =c ;
		c = abs(a - b);
		if (c==0)
		{
			break;
		}
		
		if (a > b)
		{
			a = c;
			
			c1 = b + c;
		}
		else if (a<b)
		{
			
			b = c;
			
		}
	}
	g = c1;
	l = a1*b1 / g;
	cout << l << " " << g;

	
}

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",gcd, lcm);
    //std::cout << gcd << " " << lcm << 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;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}