View Code of Problem 59

#include <stdio.h>
#include <math.h>

int main()
{
    int n,m,i,j,p;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n&&i<=m;i++){
        if(n%i==0&&m%i==0)
            p=i;
    }
    j=n*m/p;
    printf("%d %d",j,p );

    return 0;
}

Double click to view unformatted code.


Back to problem 59