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 <stdio.h>
#include <stdlib.h>
#include <math.h>
double gcd( double m, double n );
double lcm( double m, double n );
int main(int argc, const char * argv[])
{
    double a=0.0;
    double b=0.0;
    
    while(scanf("%lf",&a)!=EOF){
        scanf("%lf",&b);

        double g = gcd(a, b);
        double l = lcm( a,b );
        
        
        printf("%d",int(g));
        printf(" ");
        printf("%d\n",int(l));
        
    }
    
}
double gcd( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n);
}

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

int LCG(int x, int y);

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

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

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

main()
{
	int m,n,r,t,min,max;
	while(cin>>m>>n)
	{
		max=m;
		min=n;
		if(n>m)
		{
			t=min;
			min=max;
			max=t;
		}
		while(r=max%min)
		{
			max=min;
			min=r;
		}
		r=m/min*n;
		cout<<min<<" "<<r<<endl;
	}
}

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

bool p[1000100];

int main(){
    long long a, b;
    while(cin >> a >> b){
        cout << __gcd(a, b) << " " << a*b/__gcd(a, b) << endl;
    }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<climits>
using namespace std;
static long long a, b;

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

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

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

using namespace std;

int d(int, int);
int dd(int, int);

int main(){
  int a, b;
  cin >> a >> b;
  printf("%d %d\n", d(a, b), dd(a, b));
  return 0;
}

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

int dd(int a, int b)
{
  return a  / d(a, b) * b;
}

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

C++: #include <iostream>

using namespace std;

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

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) << " " << lem(a,b) << endl;
	}
}

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

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

int GCD(long long int a, long long int b){
    if(a < b) swap(a,b);
    if(b == 0) return a;
    else return GCD(b,a%b);
}
int LCM(int gcd, long long int a, long long int b) {
    return a * b / gcd;
}

int main(){
    int gcd,lcm;
    long long int a,b;
    while(1){
        cin >> a >> b;
        if(cin.eof()) break;
        gcd = GCD(a,b);
        lcm = LCM(gcd,a,b);
        cout << gcd << " " << lcm << endl;
    }
    return 0;
}

C++: #include<stdio.h>


//公約数の関数
int kouyakusuu_f(unsigned long long int a,unsigned long long int b)
{
	//返す変数
	int kouyakusuu_ans = 0;

	//無限ループ
	for (int i = a;;i -= 2)
	{
		//両方割れるなら
		if (a %i == 0)
		{
			if (b % i == 0)
			{
				kouyakusuu_ans = i;
				break;
			}
		}
	}

	return kouyakusuu_ans;
}



//公倍数の関数
unsigned long long int koubaisuu_f(unsigned long long int a,unsigned long long int b)
{
	//保存用変数(aとbをもう入れちゃう)
	unsigned long long int hozon1 = a,hozon2 = b;
	//インクリメント変数
	int count1 = 0,count2 = 0;

	//合うまで続ける
	while (hozon1 != hozon2)
	{
		//aのほうが小さいとき(bが大きい)
		while (hozon1 < hozon2)
		{
			count1++;
			//小さいaを少しずつ増やす
			hozon1 = a * count1;
		}
		//bの方が小さいとき(aが大きい)
		while (hozon2 < hozon1)
		{
			count2++;
			//小さいbを少しずつ増やす
			hozon2 = b * count2;
		}
	}

	//どうせ同じだからどっちでも問題ない
	return hozon1;
}




int main(void)
{
	//公倍数と公約数
	unsigned long long int kouyakusuu = 0;
	unsigned long long int koubaisuu = 0;
	//入力
	int a = 0,b = 0;

	//回しまくる
	while (scanf("%d %d",&a,&b) != EOF)
	{
		//同じ値ならそのマンまでいいでしょう
		if (a != b)
		{
			//公約数を関数よりもとめる
			kouyakusuu = kouyakusuu_f(a,b);
			//公倍数を関数により求める
			koubaisuu = koubaisuu_f(a,b);
		}
		//同じ値ならそのまま
		else
		{
			koubaisuu = a;
			kouyakusuu = a;
		}
		//表示
		printf("%llu %llu\n",kouyakusuu,koubaisuu);
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if (a > b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;
  }
  else if(a == b){
    cout << a << " " << a << endl;
  }
  else if(a == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(b == 0){
    cout << "0" << " " << "0" << endl;
  }
 }
 return 0; 
}

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

using namespace std;

int gcd(int a, int b) {
  for(int t; t = a % b; a = b, b = t);
  return b;
}

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

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

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

void solve(int a, int b){
  if(a < b)
    swap(a, b);
  int gcd = GCD(a, b);
  cout << a / gcd * b << " " << gcd << endl;
}

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

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

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

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

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

    }
    return 0;
}