View Code of Problem 59

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main(){
	while(1){
	int a,b,n1,n2,team;
	scanf("%d %d",&a,&b);
	if(a<b){
	team=a;
	a=b;
	b=team;
	}
	n1=a;
	n2=b;
	while(b!=0){
	team=a%b;
	a=b;
	b=team;
	}
	printf("%d ",a);
	printf("%d\n",n1*n2/a);
	}
}

Double click to view unformatted code.


Back to problem 59