View Code of Problem 59

#include<stdio.h>
int main()
{
	int x,y,a,b,s1,s2;
	scanf("%d%d",&a,&b);
    x=a;
	y=b;
	while(x!=y)
	{
		if(x>y)
			x=x-y;
		else
			y=y-x;
	}
	s1=x;
	s2=a*b/s1;
	printf("%d %d",s2,s1);
	return 0;


}

Double click to view unformatted code.


Back to problem 59