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<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
#define MAXM 20006
#define MAXN 1006
#define INF 2100000000
using namespace std;
int n,m;
int gcd(int x,int y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
int main()
{
    while(scanf("%d",&n)==1)
    {
        scanf("%d",&m);
        int g=gcd(n,m);
        printf("%d %d\n",g,(n/g)*m);
    }
}

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

C++: #include <iostream>
using namespace std;
 
long long int gcd(long long int x,long long int y) {
  if(y == 0) return x;
  else {
    return gcd(y,x % y);
  }
}
int main() {
  long long int a,b;
  while(cin >> a >> b) {
    cout << gcd(a,b) << " " << a * b / gcd(a,b) << endl;
  }
}

C++: 
#include <iostream>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
int n,m;

int GCDi(int a,int b){
   if(b!=0)return GCDi(b,a%b);
    return a;
}
int LCMi(int a,int b){
    int t;
    t = GCDi(a,b);
    return a/t*b;
}
int main(){        int q[100],r[100],p = 0;

    while(~scanf("%d%d",&n,&m)){
        if(n > m){q[p] = GCDi(n,m);r[p] =LCMi(n,m);}
        else {q[p] = GCDi(m,n) ;r[p] =LCMi(m,n);}
        p++;
    }
    for(int i = 0;i < p;i ++) cout<<q[i]<<" "<<r[i]<<endl;
        return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;

long long int gcd(long long int m,long long int n){
	if(m==0||n==0){
		return 0;
	}
	while(m!=n){
		if(m>n){
			m = m-n;
		}
		else{
			m = n-m;
		}
	}
	return m;
}
long long int lcm(long long int m,long long int n){
	if(m==0||n==0){
		return 0;		
	}
	else{
		return ((m/gcd(m,n))*n);
	}
}

int main() {
	long long int a,b,G,L;
	while(true){
		cin>>a>>b;
		if (cin.eof())break;
		G=gcd(a,b);
		L=lcm(a,b);
		cout<<G<<" "<<L<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>using namespace std;
int gcd(int a, int b)

if(a < b) {
  return gcd(b, a);
}

    while(r!=0){
    q=b/a;
    r=b%a;
    b=a;
    a=r;
    }
    return b;
}

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

C++: #include<iostream>

using namespace std;

long long int a,b;

int main(void)
{
	while(cin>>a>>b){
		long long int x,y;
		x=1;
		for(int i=2;i<=a&&i<=b;){
			if(a%i==0&&b%i==0){
				x=x*i;
				a=a/i;
				b=b/i;
				i=2;
			}else{ i++; }
		}
		y=x*a*b;
		cout<<x<<" "<<y<<endl;
	}
}

C++: #include <stdio.h>

long GetGCD(long x, long y);

int main(void){
    long  n,m,gcd,lcm;
    
    while (scanf("%ld %ld", &n, &m)!=EOF){
        gcd = GetGCD(n,m);
        lcm = n * m / gcd;
        printf("%ld %ld\n", gcd, lcm);
    }
    return 0;
}

long GetGCD(long x, long y){
    return y%x ? GetGCD(y%x, x) : x;
}

C++: #include<iostream>
using namespace std;
typedef long long int ll;

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

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


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

C++: #include <iostream>


using namespace std;

int main(){
	
	int ii = 1;
	int a;
	int b;
	while (1){
		
		cin >> a >> b;
	for (int i = 0; i <= 2000000001; i++){
		
		
		int c = ii / a * a;
		int d = ii / b * b;
		if (ii == c&&ii == d){
			cout << a * b / ii <<  " " <<ii<< endl;
			break;
		}
		else ii++;

}
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,aa,b,bb,c,s,ss;
	while(scanf("%d %d",&a,&b)!=EOF){
		aa=a;  
		bb=b;
		if(a<b){
			c=a;
			a=b;
			b=c;
		}
		while(1)	{
			if(a%b==0)	{
				break;
			}
			else	{
				c=a%b;
				a=b;
				b=c;	
			}
		}
		s=b;
		ss=aa/b*bb;
		printf("%d %d\n",s,ss);
	}
	return 0;
}

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


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

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

int Func_gcd(int num1, int num2){
	int surplus;

	while((surplus=num1%num2) != 0){
		num1 = num2;
		num2 = surplus;
	}
	
	return num2;
}

int main()
{
    int gcd, lcm;
	int num1, num2;
	
	while(cin>>num1>>num2){
		gcd = Func_gcd(num1, num2);
		lcm = num1 / gcd * num2;
				
		cout << gcd << " " << lcm << "\n";
	}
	
	return 0;
}

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

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

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

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    cout << endl;
    }

}

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 <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;
			
		cout<<n_prime[n]<<endl;
	}
	return 0;
}