View Code of Problem 59

#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:4996);
#include <stdio.h>
#include <string.h>
#include <math.h>
#define N 100000
int main()
{
	int a, b;
	int c, d;
	int gys, gbs;
	int temp;
	scanf("%d%d", &a, &b);
	if (a > b)
	{
		int t;
		t = a;
		a = b;
		b = t;
	}
	c = a;
	gys = b % a;
	while (gys)
	{
		a = gys;
		gys = b % a;
	}
	gbs = c * b / a;
	printf("%d %d", gbs, a);
	return 0;
}

Double click to view unformatted code.


Back to problem 59