View Code of Problem 59

#include<stdio.h>
int com(int m,int n)
{
	int temp;
	temp=m%n;
		while(temp!=0)
		{
			m=n;
			n=temp;
			temp=m%n;
		}
		return n;
}
int mul(int s,int k)
{
	int r;
	r=com(s,k);
	return s*k/r;	
}
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	printf("%d %d",mul(a,b),com(a,b));
	return 0;
}

Double click to view unformatted code.


Back to problem 59