View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59