View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59