View Code of Problem 59

#include <stdio.h>

int main() 
{ 
  int m,n,gcd,a;
  scanf("%d%d",&m,&n);
  
  for(a=1;a<=m||a<=n;a++)
  {
	if(m%a==0&&n%a==0)
	gcd=a;
	
	
	
  } 
	printf("%d %d",gcd,m*n/gcd);
	
}

Double click to view unformatted code.


Back to problem 59