View Code of Problem 59

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

Double click to view unformatted code.


Back to problem 59