View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59