Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include<iostream>
#include<stdio.h>

using namespace std;

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

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

int main(){
	long long int a,b;
	
	while(scanf("%lld %lld",&a,&b) != EOF){
		cout << gcd(a,b) << " " << lcm(a,b) <<  endl;
	}
	return 0;
}

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

int main(){
    unsigned int a,b,c;
    int g[50],l[50];
    int p;
    for(int i=0;i<50;i++;){
        cin>>a>>b;
        p=a*b;
        while(b!=0){
            c=b;
            b=a%b;
            a=c;
        }
        g[i]=a;
        l[i]=p/g[i];
    }
    for(int i=0;i<50;i++;){
        cout<<g[i]<<" "<<l[i]<<endl;
    }
    return(0);
}

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

int gcd(int u, int v){
	while(u > 0){
		int t;
		if(u < v){ t = u; u = v; v = t; }
		u = u % v;
	}
	return v;
}

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

C++: #include<iostream>
using namespace std;
int gcd(int a,int b){
  if(b>0){
    return gcd(b,a%b);
  }else{
    return a;
  }
}

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;
  }
}

C++: #include<stdio.h>


void swap(int *a, int *b){
	int w = *a;
	*a = *b;
	*b = w;
}

int gojoho(int a, int b){
	if(b > a){
		swap(&a, &b);
	}
	while(1){
		int r = a % b;
		if(r == 0){
			break;
		}
		a = b;
		b = r;
	}
	return b;
}

int main(){
	int a, b;

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

C++: #include <stdio.h>
int GCD(int a, int b)
{
	return b == 0 ? a : GCD(b, a%b);
}
long long int lcm(long long int a, long long int b)
{
	return (a*b / GCD(a, b));
}

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

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

int main(){
    unsigned int a,b,c;
    cin>>a>>b;
    int g,l,p;
    p=a*b;
    while(b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    g=a;
    l=p/g;
    cout<<g<<" "<<l<<endl;
}

C++: #include <iostream>


using namespace std;

int main(){
	int a;
	int b;
	int ii = 1;
	cin >> a >> b;
	for (int i = 0; i <= 2000000000; 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 <bits/stdc++.h>
using namespace std;

typedef long long ll;

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


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

C++: #include <iostream>
#include <vector>
#include <bitset>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <stack>
#include <queue>
#include <stdio.h>
#include <limits.h>
#include <string.h>

using namespace std;
/*
 greatest common division
 
 8 6 
 
 8%6 2
 
 */
int calcGCD(int a, int b){
    if(b == 0) return a; 
    else return calcGCD(b%a, a%b);
}

int calcLCM(int a, int b){
    int t = calcGCD(a, b);
    //cout<<t<<endl;
    if(t != 0) return (a / t * b);
    else return 0;
}

int main(){
    int n,m;
    while(cin>>n>>m){
        cout<<calcGCD(n,m)<<" "<<calcLCM(n,m)<<endl;
    }
}

C++: #include<cstdio>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int x,y;
while(~scanf("%d%d",&x,&y))printf("%d %d\n",g(x,y),a*b/g(x,y));
}

C++: include<iostream>
long long gcd(long long a,long long b){
  if(b==0) return a;
  gcd(b,(a%b));
}

int main() {
  long long i,j,res;
  while(std::cin>>i>>j) {
    res=gcd(i,j);
    std::cout<<res<<" "<<(i*j)/res<<"\n";
  }
}

C++: #include<iostream>

using namespace std;

int main()
{
	
	int a, b;
	int temp;
	int big, small;
	
	while(cin>>a>>b){
		
		if(a < b){
			big = b;
			small = a;
		}
		else{
			big = a;
			small = b;
		}
		
		for(;;){
			temp = big % small;
			if(temp == 0){
				break;
			}
			if(temp > small){
				big = temp;
			}
			else{
				big = small;
				small = temp;
			}
		}
		cout << small <<" "<< a*b/small << endl;
	}
}

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int GCD(int a,int b)
{
	if (a%b==0)
		return b;
	else
		return GCD(b,a%b);
}
int cmp(const void *a,const void *b)
{
	return *(int*)b-*(int*)a;
}
int main()
{
	float a[2],gcd,lcm;
	while(cin>>a[0]>>a[1])
	{
		if (cin.eof())break;
		qsort(a,2,sizeof(int),cmp);
		gcd=GCD(a[0],a[1]);
		lcm=(a[0]*a[1])/gcd;
		cout<<(int)gcd<<' '<<(int)lcm<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=1,m=1;
	if(a<b)swap(a,b);
	else 
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		
		if(a!=0&&b!=0)if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		if(m==0)m=1;
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
	}
}

C++: #include "stdio.h"

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

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

		for(int i = b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll unsigned long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  long long a,n;
  while(cin>>a>>n){
  cout<<gcd(a,n)<<" "<<lcm(a,n)<<endl;
  }
}

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

long long  a[51];
long long b[51];
long long A[51];
long long B[51];
long long fun(long long _a,long long _b)
{
   long long c;
   while(_b!=0)  /* 余数不?0，??相除，直到余数?0 */
   {
       c=_a%_b;
       _a=_b;
       _b=c;
    }
   return _a;
}
int main()
{
    int i=1;
    while(~scanf("%lld%lld",&a[i],&b[i]))
    {
       A[i]=fun(a[i],b[i]);//最大
       B[i]=a[i]*b[i]/fun(a[i],b[i]);
       i++;
    }
    for(int j=1;j<i;j++)
    {
       printf("%d ",A[j]);
       printf("%d\n",B[j]);
    }
    return 0;
}

C++: #include<stdio.h>
int main(void) {
	long long int a, b, minans = 0, maxans;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		for (long long int i = 2; i < b / 2; i++)
		{
			if (a%i == 0 && b%i == 0)maxans = i;
		}
		for (long long int i = b; i <= a*b; i++)
		{
			if (i%a == 0 && i%b == 0) {
				minans = i;
				break;
			}
		}
		printf("%lld %lld\n", maxans, minans);
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        long long a,b,gcda,gcdb,c;
        while(scanf("%lld %lld",&a,&b)!=EOF){
                if(a<b){
                        swap(a,b);
                }
                gcda=a;
                gcdb=b;
                while(gcda%gcdb){
                        c=gcdb;
                        gcdb=gcda%gcdb;
                        gcda=c;
                }
                printf("%lld %lld\n",gcdb,(a*b)/gcdb);
        }
        return 0;
}