View Code of Problem 59

#include <stdio.h>
int main(){
   int m,n,i,j,k,temp;
  scanf("%d %d",&m,&n);
  if(m<n){
     temp=m;
    m=n;
    n=temp;
  }
  for(i=m;;i++){
     if(i%m==0&&i%n==0)
        break;
  }
  while(n!=0){
     j=m%n;
    m=n;
    n=j;
  }
  printf("%d %d",i,m);


}

Double click to view unformatted code.


Back to problem 59