View Code of Problem 59

#include <stdio.h>
int main( ){
	int a,b;
	scanf("%d%d",&a,&b);
	int gy,gb;
	int i;
	for(i=2;;i++){
		if(a%i==0){
			if(b%i==0)
			gy=i;
			break;
		}
	}
	gb=(a*b)/gy;
	printf("%d %d",gb,gy);
}

Double click to view unformatted code.


Back to problem 59