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>

int main(){
int a,b;
int x,y,i,j;

while(scanf("%d %d",&a,&b) != EOF){
if(a>=b){
for(i=1;i<=b;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
else if(b>a){
for(i=1;i<=a;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
if(a>=b){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(a*i==b*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
else if(b>a){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(b*i==a*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
printf("%d %d\n",x,y);
}
return 0;
}

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

long gcd(long a, long b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
int main(void){
    int a, b;
    while(cin >> a >> b){
        long s = gcd(a, b);
        cout << s << " " << a*b/s << endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),std::__gcd(a,b)*b);return 0;}

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

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

  return gcd(b,a%b);
}

int main(){
  while(true){
    int a,b;

    cin>>a>>b;

    if(cin.eof())
    break;

    int g=gcd(a,b);
    cout<<g<<' '<<a/g*b<<endl;
  }

  return 0;
}

C++: #include <cstdio>
using namespace std;
int a, b, d, e;
int gcd(int x, int y)
{
	if (x<y)
	{
		x+=y;
		y=x-y;
		x-=y;
	}
	if (y==0)
	return x;
	else
	return gcd(y, x%y)
}
int lcm(int x, int y)
{
	return (long long)x*y/d;
}
int main()
{ 
	while (scanf("%d%d", &a, &b)!=EOF)
	{
		d = gcd(a,b);
		e = lcm(a, b);
		printf("%lld %lld\n", d, e);
	}
}

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

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

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

C++: #include <stdio.h>

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

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

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;

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

int main(){
    int A,B;
	while(cin>>A>>B){
		printf("%d %d\n",gcd(A,B),A*B/gcd(A,B));
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
int getmax(int a,int b){
	if(b==0) return a;
	return getmax(b,a%b);
}
int getmin(int a,int b){
	return a*b/getmax(a,b);
}
int main(){
	int a;
	int b;
	int t;
	while(scanf("%d%d",&a,&b)){
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
	cout<<getmax(a,b)<<endl;
	cout<<getmin(a,b)<<endl;
	}
	return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		//if(b==0)break;
	}
	if(a!=0)cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;
		gcd = b;
		while (a % b != 0){
			r = a % b;
			a = b;
			gcd = a;
			b = r;
		}

		lcm /= gcd;

		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int t;
	for (t = 0; t < 50; t ++) {
		int a, b, i, GCD, LCM;
		cin >> a >> b;
		if (a > b) {
			swap(a, b);
		}
		for (i = 1; i <= a && i <= b / 2; i++) {
			GCD = GCDr(a, b, i, GCD);
		}
		GCDr(a, b, i, GCD);
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

C++: #include <stdio.h>

long long int a ;
long long int b ;

long long int gcd ( ) ;

int main ( )
{
	while ( scanf ( "%lld %lld" , &a , &b ) == 2 ) {
		long long int oa = a ;
		long long int ob = b ;
		long long int tmp = gcd ( ) ;
		printf ( "%lld %lld\n" , tmp , oa / tmp * ob ) ;
	}
	return 0 ;
}

long long int gcd ( )
{
	while ( ( a %= b ) && ( b %= a ) ) ;
	return ( a + b ) ;
}

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


 
int main(){
	int in[2],a,b,ans[2],i = 1,n,stop = 1;
	while(cin >> in[0] >> in[1]){
		a = in[0];
		b = in[1];
		if(a >= b){
			while(a >= 0){
				if(in[0] % a == 0 and in[1] % a == 0){
					ans[0] = a;
					break;
				}
				a--;
			}
		}else if(b >= a){
			while(b >= 0){
				if(in[0] % b == 0 and in[1] % b == 0){
					ans[0] = b;
					break;
				}
				b--;
			}
		}else{
			ans[0] = 1;
		}
		cout << ans[0] << endl;
		a = in[0];
		b = in[1];
		ans[1] = 1;
		n = 1;
		i = 1;
		while(i <= a or i <= b and stop == 1){
		n = 1;
		cout << " << i = " << i << endl;			
			while(i >= n){
				cout << "n = " << n << endl;
				if(a * i == b * n){
					ans[1] = a * i;
					stop = 0;
					break;
				}
				n++;
			}
		
		i++;
		}
		stop = 1;
		cout << ans[1] << endl;
		
	}
}

C++: #include <stdio.h>

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

int lcm(int a, int b){
	if ((a==0)||(b==0)){
		return 0;
	}
	return ((a / gcd(a, b)) * b);
}

int main(void){
	int a,b,x,y;
	while(scanf("%d %d",&a,&b)!=EOF){
		x=gcd(a,b);
		y=lcm(a,b);
		printf("%d %d\n",x,y);
	}
}

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

long gcd(long a, long b){
	if (a % b == 0){
		return b;
	}
	else {
		return (gcd(b, a%b));
	}
}
long lcm(long a, long b){
	long gc = gcd(a,b);
	long x = a*b;
	x = x / gc;
	return x;

}

int main(){
	long a,b;
	while (cin >> a >> b){
		long gc = 0;
		if (a >= b){
			gc = gcd(a, b);
		}
		else{
			gc = gcd(b,a);
		}
		long lc = 0;
		if (a >= b){
			lc = lcm(a, b);
		}
		else{
			lc = lcm(b,a);
		}
		cout << gc << " " << lc << endl;

		

	}



	return 0;
}

C++: #include <stdio.h>

typedef long long ll;

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

int main()
{
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		ll _gcd = gcd(a,b);
		printf("%lld %lld\n",_gcd,a*b/_gcd);
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  long long  a,b,c,A,B;
  while(cin>>a>>b){
    A=a;
    B=b;
    while(b!=0){
      c=a%b;
      a=b;
      b=c;
    }
    cout<<a<<' '<<A/a*B<<endl;
  }
  
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define INF 1<<25

using namespace std;


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

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

int a, b;

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

	return 0;
}