Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

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

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

int main(){
    long long i,j;
    while(scanf("%lld %lld",&i,&j)==2){
    printf("%lld %lld\n",gcd(i,j),(i*j)/gcd(i,j));
    }
    return 0;
}

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

int main(){
   unsigned long long int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      while(1){
         if(a<b){
            tmp=a;
            a=b;
            b=tmp;
         }
         if(a%b==0){
            m=b;
            break;
         }else a=a%b;
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<stdio.h>

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

int LCM(int x,int y)
{
	for(int i=1;i<=y;i++)
	{
		if((x*i)%y==0)
			return x*i;
	}
	return x*y;
}

int main()
{
	int x,y;
	while(scanf("%d%d",&x,&y)!=EOF)
	{
		if(x>y)
		{
			int temp=y;
			y=x;
			x=temp;
		}
		printf("%d %d\n",GCD(x,y),LCM(x,y));
	}
}

C++: #include <iostream>

using namespace std;

long long gcd(long long a,long long b){
	long long  r=0;
	while((r=a%b)!=0){
		a=b;
		b=r;
	}

	return b;
}


int main (void){
	long long a,b,r;
	while(cin>>a>>b){
		if(a<b){
			a+=b;
			b=a-b;
			a-=b;
		}

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

int gcd(int a, int b){
    return b ? gcd(b, a%b) : a;
}

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

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

int main(){

	int a,b,GCD,LCM,c;

	while(cin>>a>>b){

		if(a>b){
			c=b;
		}
		else{
			c=a;
		}

		for(int i=1;i<=(c/2+1);i++){
			if(b%i==0 && a%i==0){
				GCD = i;
			}
		}
		if(b%a==0 || a%b==0){
			GCD = c;
		}
		LCM=a/GCD*b;
		cout<<GCD<<" "<<LCM<<endl;
	}

	return 0;
}

C++: #include <iostream>

// Greatest Common Divisor 最大公約数
int GCD( int a, int b) {
	int bi, sm, r;
	if(a>b) {bi = a; sm = b;} else {bi = b; sm = a;}
	r = bi % sm;
	if(r==0) return sm;
	return GCD( sm, r);
}

// Least Common Multiple 最小公倍数
// gcd( a, b) * lcm( a, b) = a * b

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

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


int main()
{
	int a[100],b[100];
	int i=0;
	while(cin >> a[i] >> b[i]){i++;}
	for(int j=0;j<i;j++){
		int c;
		int d=a[j],e=b[j];
		if (a[j]<b[j]){c=a[j];a[j]=b[j];b[j]=c;}
		while(a[j]%b[j]!=0){
			c=a[j];
			a[j]=b[j];
			b[j]=c%b[j];
		}
		cout << b[j] <<" " <<d*e/b[j] <<  endl;
	}
    return 0;
}

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

using namespace std;

int gcd(int a,int b)
{
    if(b <= 1 || a == b)
        return a;
    else
        return gcd(b,a%b);
}
int lcm(int a, int b)
{
    int g = gcd(a,b);
    return (a / g) * 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 <cstring>
#include <algorithm>
#include <math.h>
using namespace std;
#define MAX 1000010
long long gcd(long long a,long long b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}
int main()
{
    long long a,b;
    while(~scanf("%lld%lld",&a,&b))
    {
        long long ans=gcd(a,b);
        printf("%lld %lld\n",ans,a/ans*b);
    }
    return 0;
}

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

using namespace std;

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

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

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

int main(){

	int a,b,GCD,LCM,c;

	while(cin>>a>>b){

		if(a>b){
			c=b;
		}
		else{
			c=a;
		}

		for(int i=1;i<=(c/2+1);i++){
			if(b%i==0 && a%i==0){
				GCD = i;
			}
		}
		if(b%a==0 || a%b==0){
			GCD = c;
		}
		LCM=a*b/GCD;
		cout<<GCD<<" "<<LCM<<endl;
	}

	return 0;
}

C++: #include <iostream>
#include <iomanip>
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 argc, char **argv)
{
	int a, b;
	while (cin >> a >> b)
		cout << GCD(a, b) << " " << LCM(a, b) << endl;
	
	return 0;
}

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

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

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

using namespace std;

typedef long long int llongi;

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

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

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

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

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

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

int main() {
	// your code goes here
	long long int a,b;
	long long int miner,maxer;
	while(cin >> a >> b){
		int a2=a,b2=b;
		while(max(a2,b2)%min(a2,b2)!=0){
			if(a2>b2)
			a2=a2-b2;
			else
			b2=b2-a2;
		}
		miner =min(a2,b2);
		cout << miner << endl;
		cout << a*b/miner << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    long long i,a,b,c;
    while(cin>>a>>b){
        if(a==b){
            cout<<a<<" "<<a<<endl;
        }
        else{
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long j=i;j>0;i--){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    cout<<c<<" "<<a*b/c<<endl;
        }
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int a,b,big,small,r;

    while(1){
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        
        if(a > b){
            big = a;
            small = b;
        }
        else {
            big = b;
            small = a;
        }
        
        r = big % small;
        while(r != 0){
            big = small;
            small = r;
            r = big % small;
        }
        
    }
    
    cout << small << ' ' << (a / small) * (b / small) * small << endl; 

    return 0;
}

C++: #include <algorithm>
#include <iostream>
using namespace std;
int main() {
	long long a, b;
	while (cin >> a >> b) {
		cout << __gcd(a,b) << " " << a / __gcd(a,b) * b << "\n";
	}
}