Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include<stdio.h>
main(a,b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b);
}

C++: #include <iostream>
int gcd(int a, int b)
{
  while (1) {
    if (b == 0) {
      return a;
    }
    int temp = b;
    b = a % b;
    a = temp;
  }
}

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

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

C++: #include<stdio.h>



//公約数
long long int kouyakusuu_f(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	//怖いからここでiを宣言
	long long int i = 0;

	//お互いを割って０なら小さいほうを返す(6と１２　高速道路)
	if (hozon1 % hozon2 == 0)
	{
		return hozon2;
	}
	if (hozon2 % hozon1 == 0)
	{
		return hozon1;
	}
	//それでも駄目なら小さいほうを２で割る
	if (hozon1 < hozon2)
	{
		i = hozon1 / 2;
	}
	else
	{
		i = hozon2 / 2;
	}


	while (1)
	{
		if (hozon1 % i == 0 && hozon2 % i == 0)
		{
			return i;
		}
		//２個ずつ減らす
		i -= 2;
	}

}





//公倍数
long long int koubaisuu(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	long long int cnt1 = 1,cnt2 = 1;

	//保存１を保存２で割ると０のとき
	if (hozon1 % hozon2 == 0)
	{
		return hozon1;
	}
	//保存２を保存１で割ると０のとき
	if (hozon2 % hozon1 == 0)
	{
		return hozon2;
	}
	
	//合うまで回す
	while (1)
	{
		if (hozon1 == hozon2)
		{
			return hozon1;
		}
		while (hozon1 < hozon2)
		{
			cnt1++;
			hozon1 = *a * cnt1;
		}
		while (hozon1 > hozon2)
		{
			cnt2++;
			hozon2 = *b * cnt2;
		}
	}

	return hozon1;
}




int main(void)
{
	//入力変数
	long long int a = 0,b = 0;
	//出力変数
	long long int ans1 = 0, ans2 = 0;

	//回す
	while (scanf("%lld %lld",&a,&b) != EOF)
	{
		//計算してもらう(公約数)
		ans1 = kouyakusuu_f(&a,&b);
		//次は公倍数
		ans2 = koubaisuu(&a,&b);
	
		//表示
		printf("%lld %lld\n",ans1,ans2);
	}


	return 0;
}

C++: #include<stdio.h>
long long  GCD(long long m,long long n)
{
    long long t,r;
    if(n>m)
   {
   	t=m;
   	m=n;
	n=t;
	}
	while(n!=0)
	{
		r=m%n;
		m=n;
		n=r;
	}
	return m;
}
long long LCM(long long m,long long n)
{
    long long num;
    num=(n*m)/GCD(m,n);
    return num;
}
int main()
{
    long long n,m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        printf("%d %d\n",GCD(m,n),LCM(m,n));
    }
    return 0;

}

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

typedef long long ll;

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

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

C++: #include <bits/stdc++.h>
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 main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (j%a != 0 || j % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}

C++: #include <stdio.h>

int main(){

    int buf1[50],buf[50];

    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;

    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b 1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else printf( "%d ",b2 );

        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ){
                printf( "%d\n",m );
                break;
        }
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    reutrn 0;
}

C++: #include <stdio.h>

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

while(scanf("%d %d",&a,&b) != EOF){
if(a>=b){
for(i=1;i<=b;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
else if(b>a){
for(i=1;i<=a;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
if(a>=b){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(a*i==b*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
else if(b>a){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(b*i==a*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
printf("%d %d\n",x,y);
}
return 0;
}

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

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

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),std::__gcd(a,b)*b);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;

    int g=gcd(a,b);
    cout<<g<<' '<<a/g*b<<endl;
  }

  return 0;
}

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

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;
    while(cin >> a >> b) {
      int lcm = b * a / gcd(a,b);
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int gcd(int a, int b) {
	while(b) { int t = b; b = a % b; a = t; }
	return a;
}

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

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;

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

int main(){
    int A,B;
	while(cin>>A>>B){
		printf("%d %d\n",gcd(A,B),A*B/gcd(A,B));
	}
    return 0;
}

C++: #include<iostream>
using namespace std;
int getmax(int a,int b){
	if(b==0) return a;
	return getmax(b,a%b);
}
int getmin(int a,int b){
	return a*b/getmax(a,b);
}
int main(){
	int a;
	int b;
	int t;
	while(scanf("%d%d",&a,&b)){
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
	cout<<getmax(a,b)<<endl;
	cout<<getmin(a,b)<<endl;
	}
	return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		//if(b==0)break;
	}
	if(a!=0)cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;
		gcd = b;
		while (a % b != 0){
			r = a % b;
			a = b;
			gcd = a;
			b = r;
		}

		lcm /= gcd;

		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int t;
	for (t = 0; t < 50; t ++) {
		int a, b, i, GCD, LCM;
		cin >> a >> b;
		if (a > b) {
			swap(a, b);
		}
		for (i = 1; i <= a && i <= b / 2; i++) {
			GCD = GCDr(a, b, i, GCD);
		}
		GCDr(a, b, i, GCD);
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}