View Code of Problem 59

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

    	 
} 

Double click to view unformatted code.


Back to problem 59