View Code of Problem 59

#include <stdio.h>
#include <string.h>
#include <math.h>
#define N 100
int main()
{
	int a, b, t, c, d, gys, gbs;
	scanf("%d %d", &a, &b);
	c = a, d = b;
	gys = a % b;
	while (gys)
	{
		a = b;
		b = gys;
		gys = a % b;
	}
	gys = b;
	gbs = c * d / gys;
	printf("%d %d", gbs, gys);
}

Double click to view unformatted code.


Back to problem 59