View Code of Problem 59

#include<stdio.h>
 
int main(){
	int a,b,i,t,x,y;
	scanf("%d%d",&a,&b);
	if (b>a)
	{
		t=a;a=b;b=t;
	}
		y=1;
		for (i=2;i<=b;i++)
	{
		if (a%i==0 && b%i==0)
			y=i;
	}
		x=a*b/y;
		printf("%d %d",x,y);
	return 0;
}

Double click to view unformatted code.


Back to problem 59