View Code of Problem 59

#include<stdio.h>
#include <math.h>
#include <string.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;
	scanf("%d %d",&a,&b);
	int n=gcd(a,b);
	printf("%d %d",a*b/n,n);

	return 0;
}

Double click to view unformatted code.


Back to problem 59