View Code of Problem 59

#include<iostream>
#include<malloc.h>
#include<algorithm>
#include<cstring>
using namespace std;
int fun(int a,int b)
{
    return (b==0?a:fun(b,a%b));
}
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a*b/fun(a,b)<<" "<<fun(a,b);

    return 0;
}

Double click to view unformatted code.


Back to problem 59