View Code of Problem 59

#include<stdio.h>
main()
{
	int m,n,t,p,r;
	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);
}

Double click to view unformatted code.


Back to problem 59