View Code of Problem 59

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <stack>
#include <map>
#include <set>
#include <queue>
using namespace std;

int gcb(int a,int b)
{
    return b==0?a:gcb(b,a%b);
}

int main()
{
    int n,m;
    cin>>n>>m;
    int p=gcb(n,m);
    cout<<n*m/p<<" "<<p;

    return 0;
}

Double click to view unformatted code.


Back to problem 59