View Code of Problem 59

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	int m,n,r,p,t;
	scanf("%d %d",&m,&n);
	if(m>n)
	{
		t=m;m=n;n=t;
	}
	p=m*n;
	while(m>0)
	{
		r=n%m;
		n=m;
		m=r;
	}
	printf("%d %d",p/n,n);
	return 0;
}

Double click to view unformatted code.


Back to problem 59