View Code of Problem 59

#include<stdio.h>
int main()
{
	int m, n;
	scanf("%d %d", &m, &n);
		int max, min;
		if (m > n)
		{
			int temp = n;
			n = m;
			m = temp;
		}
		for (int i = n; i <= m * n; i++)
		{
			if (i%m == 0 && i%n == 0)
			{
				min = i;
				break;
			}
		}
		max = m * n / min;
		printf("%d %d", min, max);
	return 0;
}

Double click to view unformatted code.


Back to problem 59