View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59