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 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;
}

C++: #include <stdio.h>

int main(){

	int a=0, b=0,i=0,m=0,n=0,B=0,A=0;

	while(scanf("%d%d", &a, &b)!=EOF){
		B = b;
		A = a;
		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		m = A*B;
		m /= b;

		printf("%d\n", m); 
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int x, y, a, i, r;
    cin >> x >> y;
    while(x != 0 || y != 0){
        i = 0;
        
        if(y > x){
            a = x;
            x = y;
            y = a;
        }

        while(y != 0){
            r = x % y;
            x = r;
            r = y;
            y = x;
            x = r;
            i++;
        }
        
        cout << x << " " << i << endl;
        cin >> x >> y;
    }
    
}

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 <bits/stdc++.h>
using namespace std;
typedef long long int64;
int main(){
  int a,b;
  int temp;
  int i;
  int gcd,lcm;
  int64 A,B;
  while(scanf("%d %d",&a,&b) != EOF){
    A = a;
    B = b;
    while(b != 0){
      temp = a % b;
      a = b;
      b = temp;
    }
    gcd = a;
    lcm = (A * B) / gcd;
    cout << gcd << " " <<  lcm << endl;
  }
}

C++: #include <stdio.h>
#include <iostream>
#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);
    std::cout << a << " " << b << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a %= b;
    }else{
      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<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if ((max(a, b) % min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = a%b;
			}else b = b%a;
		}
			cout << " " << c * d / min(a,b);
	}

	return 0;
}

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

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

    return gcd(b, a % b);
}

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

int main(void)
{
    int a, b;

    while(std::cin >> a >> b)
    {
        if(a < b)
        {
            std::swap(a, b);
        }
    
        const int g = gcd(a, b);
        const int l = lcm(a, b, g);
    
        std::cout << g << " " << l << std::endl;
    }

    return 0;
}

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

int GCD(ll a, ll b){
  ll t;
  while(b){
    t = a % b;
    a = b;
    b = t;
  }
  return a;
}
int main(){
  ll a, b;
  while(cin >> a >> b){
    ll gcd = GCD(a, b);
    cout << gcd << " " << a * b / gcd << "\n";
  }
  return 0;
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[3];

	tmp[0] = std::max( a, b );
	tmp[1] = std::min( a, b );

	for( n = 0;; n++ ){
		for( i = 1;; i++ ){
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i;
			if( tmp[( n + 2 ) % 3 ] < tmp[( n + 1 ) % 3 ] ){
				break;
			}else if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
	}

	return -1;
}

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

int main()
{
	int lam,gcd,a,b,c,d;
	while(cin>>a>>b)
	{
		c=a;
		d=b;
		if(a<b)
		{
			a=a+b;
			b=a-b;
			a=a-b;
		}
		while(a%b!=0)
		{
			int temp;
			temp=b;
			b=a%b;
			a=temp;
		}
		gcd=b;
		lam=d/gcd*c;
		printf("%d %d\n",gcd,lam);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
	while(cin >> a >> b) {
	  cout << __gcd(a, b) << " " << (a*b)/__gcd(a, b) << endl;
	}
  return 0;
}

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

unsigned int gcd(const unsigned int a, const unsigned int b) {
	unsigned int result = 1;
	unsigned int k = (a < b) ? a : b;

	for (unsigned int k = 1; k <= a and k <= b; k++) {
		if (a % k == 0 and b % k == 0) { result = k; }
	}

	return result;
}

unsigned int lcm(unsigned int a, unsigned int b) {
	unsigned int mult;

	if (a > b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}

	for (unsigned int k = 1; k <= a; k++) {
		mult = b * k;
		if (mult % a == 0) { return mult; }
	}

	return 0;
}

int main() {
	unsigned int a, b;
	
	while (!std::cin.eof()) {
		std::cin >> a >> b;
		std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
	}
}