View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59