View Code of Problem 59

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

				

Double click to view unformatted code.


Back to problem 59