View Code of Problem 59

#include<stdio.h>

int main()
{
    int p,q,m,n;
    scanf("%d%d", &p, &q);
    m=p;
    n=q;
    while(m!=n)
    {
        if(m>n)
            m=m-n;
        else
            n=n-m;
    }
    printf("%d %d\n",p*q/m,m);


}

Double click to view unformatted code.


Back to problem 59