View Code of Problem 59

#include<stdio.h>
#include<math.h>
#include<string.h>
int main(int argc, char** argv) {
	
	int a , b;
	scanf("%d %d" , &a , &b);
	
	int x = a, y = b;
	
	int t;
	if(a < b){
		int x = a;
		a=  b;
		b = x;
	}
	
	while(b!=0){
		t = a % b;
		a = b;
		b = t;
	}
	
	printf("%d %d" , x * y /a , a );
	
	return 0 ;
}












Double click to view unformatted code.


Back to problem 59