View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59