View Code of Problem 59

#include "stdio.h"
#include "string.h"

void main()
{
	int x,y,a,b,r;
	scanf("%d%d",&a,&b);
	x=a;
	y=b;
	r=a%b;
	for(;r!=0;)
	{
		a=b;
		b=r;
		r=a%b;
	}
	printf("%d %d",b,x*y/b);
}

Double click to view unformatted code.


Back to problem 59