Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d\n", G, L)
	}
}

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

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

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

C++: #include<stdio.h>
#include<math.h>
int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j),i){
		x=i,y=j;
		while((i!=0)&&(j!=0)){
			if(i>j){
				i=i%j;
			}else{
				j=j%i;
			}
		}
		if(i==0){
			y=x*y/j;
			x=j;
		}else{
			y=x*y/i;
			x=i;
		}
		printf("%lld %lld\n",x,y);
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
  
using namespace std;
  
int gcd(int a, int b){
    if(a%b==0) return b;
    return gcd(b, a%b);
}
  
unsigned long long lcm(int a, int b){
    return (a*b/gcd(a, b));
}
  
int a, b;
int main(){
    while(cin>> a>> b){
        if(a<b) swap(a, b);
        printf("%d %llu\n", gcd(a, b), lcm(a, b));
    }
}

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

unsigned long gcd(unsigned long a, unsigned long b){
	unsigned long q;
	while(q = a % b){
		a = b;
		b = q;
	}
	return b;
}

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

int main(){
	unsigned long a, b;
	while(scanf("%ld %ld", &a, &b)){
		printf("%ld %ld", gcd(a, b), lcm(a, b));
	}

	return 0;
}