View Code of Problem 59

#include<stdio.h>

int main()
{
    int p,q,m,n,tmp;
    scanf("%d%d", &p, &q);
    m=p;
    n=q;
    while(n!=0)
    {
        tmp=m%n;
        m=n;
        n=tmp;

    }
    printf("%d %d\n",p*q/m,m);


}

Double click to view unformatted code.


Back to problem 59