View Code of Problem 59

#include<stdio.h>
#include<string.h>
#include<math.h>
int gyss(int x,int y)
{
	int z;
	while(y!=0)
	{
		z=x%y;
		x=y;
		y=z;
	}
	return x;
}
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	int gys=gyss(a,b);
	int gbs=a*b/gys;
	printf("%d %d",gbs,gys);
}

Double click to view unformatted code.


Back to problem 59