Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #include<iostream>

using namespace std;

//Euclidean algorithm
int gcd(long m, long n)
{
	long t;
	while (n != 0) {
		t = n, n = m % n, m = t;
	}
	return m;
}

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

int main(){
	long m, n;

	while(cin >> m >> n) {
		if(m > n) swap(n, m);
		cout << gcd(n, m) << " " << lcm(n, m) << endl;
	}

	return 0;
}

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

int saidai(long  a,long  b){
	while(b != a){
		if(a > b){
			a -= b;
		}else {
			b -= a;
		}
	}
	return a;
}


long long	saisyou( long  a,long b , long c){
	return a/c*b;
}

int main(){
	long  a,b;
	cin>>a;
	cin>>b;
	long long ans = saidai(a,b);
	cout<<ans<<" "<<saisyou(a,b,ans)<<endl;;
	return 0;

}

C++: #include<iostream>

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

int main(){
  int a, b, k;

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

C++: #include <iostream>


int LCM(int a, int b) {
  int xa, yb;
  int x = 1, y = 1;
  while (true) {
    xa = x * a;
    yb = y * b;
    if (xa == yb) {
      break;
    } else if (xa < yb) {
      x += 1;
    } else {
      y += 1;
    }
  }
  return xa;
}


int GCD(int a, int b) {
  int gcd = 1;
  int num = 2;
  while (num < a / 2 || num < b / 2) {
    if ((a % num) == 0 && (b % num) == 0) {
      gcd *= num;
      a /= num;
      b /= num;
    } else {
      num += 1;
    }
  }
  return gcd;
}

int main () {
  int a, b;
  int lcm, gcd;
  while (std::cin >> a >> b) {
    gcd = GCD(a, b);
    lcm = LCM(a, b);
    std::cout << gcd << " " << lcm << std::endl;
  }
  return 0;
}

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

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

    int max = max(a,b);
    int min = min(a,b);

    int gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j;
        break;
      }
      else{ 
        i++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

C++: #include <iostream>
using namespace std;
long long MaxDivisor(long long a, long long b);
long long MinMultiple(long long a, long long b);
int main()
{
	long long m, n;
	while (cin >> m >> n) {
		cout << MaxDivisor(m, n) << " " 
			<< MinMultiple(m, n) << endl;
	}

	//system("pause");
	return 0;
}
///??相除法求最大公?数
long long MaxDivisor(long long a, long long b) {
	long long temp, r;
	if (a < b) {
		temp = a;
		a = b;
		b = temp;
	}
	r = a % b;
	while (0 != r) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
long long MinMultiple(long long a, long long b) {
	return (a * b / MaxDivisor(a, b));
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
main()
{
	while(1)
	{
	
	long a,b,c,d,num;
	
	while(scanf("%d%d",&a,&b)!=EOF)
	{ 
	
	   
	
	num=a*b;
	
	for(;b!=0;)
    {
    	c=a%b;
    	a=b;
    	b=c;
	}
	d=num/a;
	cout<<a<<" "<<d<<endl;
}	
    } 
 }

C++: #include<cstdio>

int main(){
	long long a,b,g,l,t;
	while(scanf("%d %d", &a, &b) + 1){
		if(a > b){
			t = a;
			a = b;
			b = t;
		}

		if(b % a){
			t = a / 2;
			for(int i = 2; i <= t; i++){
				if(!(a % i)){
					g = a / i;
					if(!(b % g)){
						printf("%lld %lld\n", g, a * b / g);
						i += t;
					}
				}
			}
		}else{
			printf("%lld %lld\n", a, b);
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
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 lcm( int m, int n )
{
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	return ((m / gcd(m, n)) * n);
}
int main(){
	int a,b,i,j,t;
	while(scanf("%d%d",&a,&b)!=EOF){
		cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
	}
return 0;
}

C++: #include<iostream>

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

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

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

int main()
{
	long int a,b,i,min,max,x,y; //x最大公約数 y最小公倍数

	while(cin>>a>>b){
		x=y=0;
		if(a<b){
			min=a; max=b;
		}else{
			max=a; min=b;
		}

		for(i=min,x=0; x==0; i--){
			if(a%i==0 && b%i==0) x=i;
		}
		for(i=max,y=0; y==0; i+=max){
			if(i%a==0 && i%b==0) y=i;
		}

		cout<<x<<" "<<y<<endl;
	}
}

C++: //先辗转相除找gcd再通过gcd求lcm
#include <bits/stdc++.h>

using namespace std;

long long a,b;

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

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

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

using namespace std;

int main()
{
    int a,b;

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

        int less=(a<b)? a:b;
        int greater=(a<b)? b:a;

        for(int i=2;i<=greater;i++){
            if((a%i==0)&&(b%i==0)) gcd=i;
        }

        for(int i=greater;i<=2000000000;i++){
            if((i%a==0)&&(i%b)==0){
                lcm=i;
                break;
            }
        }

        printf("%d %d\n",gcd,lcm);
    }

    return 0;
}

C++: #include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
using namespace std;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int a,b;
    while(cin>>a>>b){
        if(a<b)swap(a,b);
        int g=gcd(a,b);
        cout<<g<<a/g*b<<endl;
    }
}

C++: #include<iostream>

int gcd(int a, int b){
    while((a % b) != 0) {
        a = b;
        b = (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){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

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

int main()
{
	int a, b;
	while (scanf_s("%d%d", &a, &b))
	{
		int g = gcd(a, b);
		int lcm = a / g*b;
		printf("%d %d\n", g, lcm);
	}
}

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			swap(a, b);
		}

		while(b != 0){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

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

int main(){
    double a,b;

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

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

using namespace std;

int main()
{
  long long int x, y;
  while(cin >> x >> y) {
    if (x < y) swap(x, y);
    long long int X = x, Y = y;
    while(1) {
      x %= y;
      swap(x, y);
      if(y == 0) break;
    }
    cout << x << ' ' << X * Y / x << endl;
  }
}