View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59