View Code of Problem 59

#include <stdio.h>
#include <string.h>
int lcb(int a,int b,int d)
{
    return a*b/d;
}
int gcd(int a, int b)
{
    if(b==0)
    {
        return a;
    }
    else
    {
        return gcd(b,a%b);
    }
}
int main()
{
    int n,m,min,max,d;
    scanf("%d %d",&n,&m);
    min=gcd(n,m);
    max=lcb(n,m,min);
    printf("%d %d",max,min);



    return 0;
}

Double click to view unformatted code.


Back to problem 59