Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

C++: #include<stdio.h>



unsigned long int gcd(unsigned long int one,unsigned long int two){		//Ååöñ
	
	unsigned long int temp,mod;
	
	if(one<two){
		temp=one;
		one=two;
		two=temp;
	}
	
	while(two!=0){
		
		mod=one%two;
		
		if(mod==0){
			
			return two;
		
		}else if(mod!=0){
			one=two;
			two=mod;
		}
	}
	return 0;
}


unsigned long int lcm(unsigned long int one, unsigned long int two){		//Å¬ö{
	return (one/gcd(one,two))*two;
}
	
int main(void){

	unsigned long int first,second;
	

	while(scanf("%d %d",&first,&second)!=EOF){
		
		if(first<=0||second<=0){
			break;
		}
		printf("%d %d\n",gcd(first,second),lcm(first,second));
	}
	
	return 0;
}

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

int u(int a, int b);
int l(int a, int b, int gcd);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b, gcd);
    std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(1){
    if(a==0) return b;
    if(b==0) return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

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

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

using namespace std;

int main()
{
    long long int a,b;
    while(scanf("%lld %lld",&a,&b)==2){
        int c;
        int d;
        if(a<b)
            d=a;
        else
            d=b;
        for(c=d;c>=2;c--){
            if(a%c==0 && b%c==0)
                break;
        }

        int e=a+b-d;
        //if(a>b)
          //  e=a;
       // else
          //  e=b;
        //int f;
        for(;;e++){
            if(e%a==0 && e%b==0)
                break;
        }
        cout << c << " " << e << endl;

    }
    return 0;
}

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

using namespace std;


int main() {

	int a, b, c=1, GCD, LCM , d,???e;

	while (cin >> a >> b) {
		d = a;
		e = b;
		while (c) {
			c = a % b;
			if (c == 0) {
				GCD = b;
				break;
			}
			else {
				a = b;
				b = c;
			}
		}
		d /= GCD;
		e /= GCD;
		LCM = d*e*GCD;

		cout << GCD << " " << LCM << endl;
		c = 1;
	}

	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 lcm(int a, int b){
	return a/gcd(a,b)*b;
}

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

C++: #include<iostream>

int main(){
	int x,y;
	std::cin>>x>>y;
	
	for(int j=x;j>0;--j){
		if(x%j==0&&y%j==0){
			std::cout<<j<<' ';
			break;
		}
	}

	for(int i=x;i>0;++i){
		if(i%x==0&&i%y==0){
			std::cout<<i<<std::endl;
			break;
		}
	}

	return 0;
}

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

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*bb/b;
		printf("%d %d\n",s,ss);
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd,lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 1;;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		
		printf("%ld %ld\n",gcd,lcm);
	}
	
	return 0;
}

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

int solvegcd(int m,int n)
{
	if(n==0){return m;}
	if(m%n==0){return n;}
	else{solvegcd(n,m%n);}
}
int solvelcm(int m,int n)
{
	int mm,nn;
	mm = m/solvegcd(m,n);
	nn = n/solvegcd(m,n);
	return mm*nn*solvegcd(m,n);
}

int main()
{
	int a,b;
	while(cin >> a && cin >> b){
		if(a != max(a,b)){
			int tmp = b;
			b = a;
			a = tmp;
		}
		cout << solvegcd(a,b) << " " << solvelcm(a,b) << endl;
	}
	return 0;
}

C++:  #include <stdio.h>

 long long int n,m,ans,amari,ahokusa;

 int main()
 {
     scanf("%lld%lld",&n,&m);
     ans  = n*m;
     if(n < m)
     {
         ahokusa = n;
         n = m;
         m = ahokusa;
     }
     amari = n % m;
     while(amari != 0)
     {
        n = m;
        m = amari;
        amari = n % m;
     }
     ans = ans / m;

     printf("%lld %lld\n",m,ans);
     return 0;

 }

C++: #include<stdio.h>
int main(void)
{
	int x,y,temp,X,xx,yy,sb;
	while(scanf("%d %d",&x,&y)!=EOF){
		xx=x; yy=y;
		if(x<=y){
			temp=x;
			x=y;
			y=temp;
		}
		while(1){
			if(y==0)break;
			X=x%y;
			x=y;
			y=X;
		}
		sb=(xx/x)*(yy/x)*x;
		printf("%d %d\n",x,sb);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int calc(int m,int n){

	if(n==0){
		return m;
	}
	else{
		return calc(n,m%n);
	}

}

int main(){

	int m,n;

	int kouyakusu;
	long long int koubaisu;

	while(cin>>m){
		cin>>n;

		if(m>=n){
			kouyakusu = calc(m,n);
		}
		else{
			kouyakusu = calc(n,m);
		}

		koubaisu = (m/kouyakusu)*n;

		printf("%d %lld\n",kouyakusu,koubaisu);

	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
	unsigned long long a,b,c,d,maxx=0,minn=0;
	while (cin>>a>>b){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=a;
			else{
				maxx=a%d;
				if (maxx==0)maxx=d;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define LL long long
LL gcd(LL a,LL b){
    LL t;
    while(a%b){
        t = a;
        a = b;
        b = t%b;
    }
    return b;
}
int main() {
    LL a,b;
    while(cin>>a>>b){
        LL G = gcd(a,b);
        LL L = a/G * b;
        cout<<G<<" "<<L<<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){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long j=i;j>0;i-=2){
        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 gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	long long a, b;

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

C++: #include <iostream>

using namespace std;

int main()
{
    long long a, b;
    long long big_n, small_n, mod;
    long long GCD, LCM;

    while (cin >> a >> b)
    {
        if (a > b)
        {
            big_n = a;
            small_n = b;
        }
        else
        {
            big_n = b;
            small_n = a;
        }

        while ((mod = big_n % small_n) != 0)
        {
            big_n = small_n;
            small_n = mod;
        }

        GCD = small_n;
        LCM = (a * b) / GCD;

        cout << GCD << " " << LCM << endl;
    }

    return 0;
}