View Code of Problem 59

#include<string.h>
#include<stdio.h>
int main(){
	int a,b,i,j,k,n,yue,bei;
	scanf("%d %d",&a,&b);
	if(a>b){
		for(i=b;i>0;i--){
			if(a%i==0&&b%i==0){
				yue=i;
				break;
			}
		}
	}
	else{
		for(i=a;i>0;i--){
			if(a%i==0&&b%i==0){
				yue=i;
				break;
			}
		}
	}
	bei=a*b/yue;
	printf("%d %d",bei,yue);
	
}

Double click to view unformatted code.


Back to problem 59