Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: #include "iostream"
using namespace std;

char a[20][20];

int main()
{
	int w,h;
	int b,c;
	
	int z=0;
	while(1)
	{
		int i,j;
		cin>>w>>h;
		if(w==0&&h==0)break;
		for(i=0;i<w;i++)
			for(j=0;j<h;j++)
			{
				cin>>a[i][j];
				if(a[i][j]=='@')
				{
					b=i;
					c=j;
				}
			}
			for(i=b;i<w;i++)
				for(j=c;j<h;j++)
				{
					if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i-1][j]=='@'||a[i][j-1]=='@'))
					{
						a[i][j]='@';
						z++;
						
					}
				}
				for(i=b;i<w;i++)
					for(j=c;j>=0;j--)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i-1][j]=='@'||a[i][j+1]=='@'))
						{
							a[i][j]='@';
							z++;
						}
					}
				for(i=b;i>=0;i--)
					for(j=c;j>=0;j--)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i+1][j]=='@'||a[i][j+1]=='@'))
						{
							a[i][j]='@';
						    z++;
						}
					}
				for(i=b;i>=0;i--)
					for(j=c;j<h;j++)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i][j-1]=='@'||a[i+1][j]=='@'))
						{
							a[i][j]='@';
							z++;
						}
					}
					
					cout<<z<<endl;
    
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
	
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 lcm(int x, int y)
{
    return (x * y / gcd(x, y));
}


int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d %d\n", gcd(a, b),lcm(a,b));
	return 0;
	
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
int main(void) {
    ll a, b, A, B;
    while (cin >> a >> b) {
        A = a; B = b;
        if (a < b) swap(a, b);
        ll r = b;
        while (r) {
            r = a % b;
            a = b;
            b = r;
        }
        cout << a << " " << (A/a) * B << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

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(true){
		int tmp=a;
		a=b;
		b=tmp-b;
		if(b==1){
		b=1;
		break;
		}
		if(a-b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <cstdio>


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

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

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

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

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

int main() {
  long a, b; 

  while(cin >> a >> b) {

    cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
  }
}

C++: #include <cstdio>

int main()
{
        unsigned long a, b;

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

        return 0;
}

C++: //
//  main.cpp
//  b
//
//  Created by h3037178 on 2017/07/31.
//  Copyright ?? 2017??´ ?????£?????????. All rights reserved.
//

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
    long long a,b,s,d;
    while(cin>>a>>b){
        for(int o=20000000;o>0;o--){
            if(a>=20000000||b>=20000000){
                break;
            }
            if(a%o==0&&b%o==0){
                s=o;
                 d=a*b/s;
                cout<<s<<" "<<d<<endl;
                break;
            }
        }
    }
}

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

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

#define MAX 256

int main(void){
	
	int max[50], min[50];
	for (int i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	int a, b;
	int i = 0;

	while (scanf("%d%d", a, b) != EOF){
		while (max[i] == 0){
			for (int j = 0; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		int j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (int j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

C++: #include <stdio.h>

int main( void ){
    float a[20],b[20];
    int nCount;
    for( int i = 0;scanf( "%f %f",&a[i],&b[i] ) != EOF;i++ ) nCount = i;

    for( int k = 0;k < i;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

C++: #include<iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#include <sstream>
typedef long long ll;
ll a,b,c,d;

ll gcd(ll a,ll b){
	c=1;
	while(c>0){
		if(a<b){switch(a,b);}
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}
ll lcm(ll a,ll b){
    d=a*b/gcd(a,b);
	return d;
}

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

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        int x = a;
        int y = b;
        while(y)
        {
            x = x%y;
            swap(x,y);
        }
        cout<<x<<" "<<a/x*b<<endl;
    }
    return 0;
}

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

int main(){
	int a, b;
	int m, n, r;
	while(cin >> a >> b){
		m = max(a, b);
		n = min(a, b);
		r = m % n;

		while(r != 0){
			m = n;
			n = r;
			r = m % n;
		}

		cout << n << ' ' << min(a,b)*(max(a,b)/n) << endl;
	}

	return(0);
}

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

using namespace std;

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

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

C++: #include<cstdio>

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