View Code of Problem 59

#include<stdio.h>
#include<math.h>
#include <string.h>
#define Max 1000
int main()
{
	int a,b,n1,n2,t;
	scanf("%d %d",&n1,&n2);
	if(n1<n2)
	{
		 t=n1;n1=n2;n1=t;
	}
	a=n1,b=n2;//da xiao
	while(b!=0)
	{
		t=a%b;
		a=b;b=t;
	}
	printf("%d %d",n1*n2/a,a);
	return 0;
	
}

Double click to view unformatted code.


Back to problem 59