View Code of Problem 59

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <iomanip>
#include<vector>
#include<math.h>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	int c = a * b;
	int t;
	while (b%a) {
		t = b;
		b = b % a;
		a = t;
	}
	cout << c / a << " " << a;
}

Double click to view unformatted code.


Back to problem 59