View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59