View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59