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>
#include <algorithm>

int main(){
    int a, b, lcm, gcm;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			_a = _a % _b;
			if(_b % _a == 0){
				gcm = _a;
				break;
			}
			std::swap(_a, _b);
		}
		lcm = a / gcm * b;
		std::cout << gcm << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {

	long long a, b;
	long long min, max;

	while (cin >> a >> b) {

		if (b > a) {
			long long dum = a;
			a = b;
			b = dum;
		}

		//cout << "a=" << a << "b=" << b << endl;
		
		//?????§??¬?´???°????±???????
		//???????????????????????????
		long long new_a = a, new_b = b;
		long long r;
		while (1) {
			r = new_a%new_b;
			if (r == 0) {
				max = b;
				break;
			}
			else {
				new_a = new_b;
				new_b = r;
				continue;
			}
		}

		//????°???¬?????°????±???????
		//2,000,000,000?????§?????????
		long long i=1, j=1;
		while (a*i<2000000000&&b*j<2000000000) {
			//cout << "ai=" << a*i << " bj=" << b*j << endl;
			if (a*i == b*j) {
				min = a*i;
				break;
			}
			else if (a*i < b*j) {
				i++;
			}
			else if (a*i > b*j) {
				j++;
			}
			
		}

		cout << max << " " << min << endl;
	}

	return 0;

}

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b,c,d;
    while (1){
        cin >> a >> b;
        if(cin.eof()){break;}
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

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

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

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <numeric>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std; 
int main(){
#define int long long
	int a, b, r, x, temp;
	while(cin >> a >> b){
	x = a*b;
	if (a<b)
	{
	temp = a;
	a = b;
	b = temp;
	}
	r = a%b;
	while (r!=0)
	{
	a = b;
	b = r;
	r = a%b;
	}
	cout << b << " " << x/b << endl;
	}
	return 0;
}

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

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

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

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;
int main() {
	ll a, b;
	while(scanf("%lld %lld", &a, &b) != EOF) {
		if(a < b) swap(a, b);
		ll m = a, n = b;
		while(n) {
			ll t = m / n;
			swap(m -= t * n, n);
		}
		printf("%ld ", m);
		ll c = b / m;
		cout << a * c << 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++: import java.util.Scanner;

class Main {
	public static long a, b;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			a = cin.nextLong();
			b = cin.nextLong();
			solve();
		}
	}
	
	public static void solve() {
		if(a < b){
			Long tmp = a;
			a = b;
			b = a;
		}
		Long g = gcd(a, b);
		System.out.printf("%d %d", g, a * b / g);
	}
	public static Long gcd(Long x, Long y){
		if(y == 0){
			return x;
		}
		return gcd(y, x % y);
	}
}

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

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

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

int main(){
    int a;
    int b;
	cin>>a>>b;
	cout<<gcd(a,b)<<' '<<lcm(a,b,gcd(a,b));
	return 0;
}

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

int YUK(int x,int y);
int SKB(double x,double y,double w);


int main(){
	int a,b;
	while(cin>>a>>b){
		int d;
		
		if(a>=b){
			d=YUK(a,b);
			cout<<YUK(a,b)<<endl<<SKB(a,b,d)<<endl;
			
		}
		else{
			d=YUK(b,a);
			cout<<d<<endl<<SKB(a,b,d)<<endl;
		}
		cout<<'\n';

	return 0;
	}
  
}

int YUK(int x, int y){
	int c = x%y;
	cout<<"余りは"<<c<<endl;
	if(c==0)
		return y;
	
	else
		return YUK(y,c);
}

int SKB(double x, double y, double w){
	double n = (x*y)/w;
	return (int)n;
}

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);
}
 
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 %lld\n", gcd(a, b), lcm(a, b));
    }
}

C++: #include <stdio.h>

long gcd(int a,int b);
long lcm(int a,int b,int n);

int main(void) {

  int a,b;
  
  while(scanf("%d %d",&a,&b)!=EOF) {

    printf("%ld %ld\n",gcd(a,b),lcm(a,b,gcd(a,b)));

  }

  return 0;

}

long gcd(int a,int b) {

  int temp;

  if(a<b) {
    temp=a;
    a=b;
    b=temp;
  }

  if(b==0) return a;

  else return gcd(b,a%b);

}

long lcm(int a,int b,int n) {

  return a/n*b;

}

C++: #include <iostream>

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

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

int main(){
	int a, b;
	while (std::cin >> a >> b){
		std::cout << gcd(a, b) << " " << lcm(a, b) << "\n";
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pb push_back

# define inOut(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
# define RESET(a) memset(a,0,sizeof(a))
# define MEMO(a) memset(a,-1,sizeof(a))
# define DEBUG puts("Debug-Has-Come-Until-Here")


typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	cin.tie(NULL);
	
	ll a,b, GCD, LCM;
	while(scanf("%lld %lld", &a, &b) != EOF){
		GCD = __gcd(a,b);
		LCM = a/GCD * b;
		printf("%lld %lld\n", GCD, LCM);
	}

	return 0;
}

C++: #include <iostream>

#define CASE double

using namespace std;

int GCD(CASE x, CASE y)
{
	if (x == 0 || y == 0)
		return x + y;
	else
	{
		if (x >= y)
		{
			x = x - y;
			GCD(x, y);
		}
		else
		{
			y = y - x;
			GCD(x, y);
		}
	}
}

int main(){
	CASE a, b;
	unsigned long int d, l;
	while (cin >> a >> b){

		d = (unsigned long int)GCD(a, b);
		l = a * b / d;
		cout << d << " " << l << endl;
	}
	return 0;
}

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

int main() {
	int n, m;
	while (2 == scanf("%d%d", &n, &m)) {
		printf("%d %d\n", __gcd(n, m), n / __gcd(n, m) * m);
	}
	return 0;
}

C++: #include <stdio.h>
 
int main(){
  
    int buf1[50],buf2[50];
  
    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;
  
    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else printf( "%d ",b2 );
  
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ){
                printf( "%d\n",m );
                break;
            }
        }
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    return 0;
}