View Code of Problem 59

#include <stdio.h>
int main(){
	
  int a,b;
  scanf("%d%d",&a,&b);
  int v=a*b;
  int r,temp;
  if(a<b){
  	temp=a;
    	a=b;
    	b=temp;
  }
  r=a%b;
  while(r!=0){
  	a=b;
    	b=r;
    	r=a%b;
  
  }
  v/=b;
  printf("%d %d",v,b);
  


return 0;
}

Double click to view unformatted code.


Back to problem 59