View Code of Problem 59

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
using namespace std;
int gcd(int a,int b)
{
	if(0==b)
		return a;
	else
		return gcd(b,b%a);
}

int main()
{
	int a,b;
	cin>>a>>b;
	cout<<a*b/gcd(a,b)<<" ";
	cout<<gcd(a,b);
	//system("pause");
}

Double click to view unformatted code.


Back to problem 59