View Code of Problem 59

#include<stdio.h>
main()
{
	int m,n,i,tmp,mul,t;
	scanf("%d %d",&m,&n);
	if(m>n)
	{
		t=m;
		m=n;
		n=t;
	}
	for(i=2;i<=m;i++)
	{
		if(m%i==0&&n%i==0)
			tmp=i;
	}
	mul=m*n/tmp;
	printf("%d %d\n",mul,tmp);
}

Double click to view unformatted code.


Back to problem 59