View Code of Problem 59

#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int sum=a*b;
	while(a%b!=0){
		int temp;
		temp=a;
		a=b;
		b=temp%b;
	}
	int x=b;
	int y=sum/x;
	cout<<y<<' '<<x;
}

Double click to view unformatted code.


Back to problem 59