View Code of Problem 59

#include <stdio.h>
#include <math.h>
#include <string.h>
int main()
{
	int a,b,m,n,t;
	scanf("%d %d",&a,&b);
	if(a<b){
		t=a;
		a=b;
		b=t;
	}
	m=a;
	n=b;
	while(n){
		t=m%n;
		m=n;
		n=t;
	}
	printf("%d %d\n",a*b/m,m);
	return 0;
}

Double click to view unformatted code.


Back to problem 59