View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59