View Code of Problem 59

    #include<stdio.h>
    int main()
    {
     int a,b,i;
      int x,y;
      scanf("%d %d",&a,&b);
      for(i=1;i<=a&&i<=b;i++)
      {
        if(a%i==0&&b%i==0)
          x=i;
      }
      y=a*b/x;
      printf("%d %d",x,y);
    }

Double click to view unformatted code.


Back to problem 59