View Code of Problem 59

#include<stdio.h>
int main()
{
	int x, y, a, b, c;
	scanf("%d%d", &x, &y);
	a = x;
	b = y;
	c = a % b;
	while (c)
	{
		a = b;
		b = c;
		c = a % b;

	}
	printf("%d %d\n", x*y / b, b);


}

Double click to view unformatted code.


Back to problem 59