View Code of Problem 59

#include<stdio.h>
void main(){
	int a,b,p,t;
	scanf("%d %d",&a,&b);
	if(a<b){
		t=a;
		a=b;
		b=t;
	}
	p=a*b;
	while(b!=0){
		t=a%b;
		a=b;
		b=t;
	}
	printf("%d %d\n",p/a,a);

}

Double click to view unformatted code.


Back to problem 59