View Code of Problem 59

#include <stdio.h>
#include <stdlib.h>
int max(int a,int b)
{
    int c=a%b;
    while(c!=0)
    {
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}
int min(int a,int b)
{
    int c;
    c=(a*b)/max(a,b);
    return c;
}

int main()
{
    int m,n;
    scanf("%d%d",&m,&n);
    int m_y=max(m,n);
    int m_b=min(m,n);
    printf("%d %d",m_b,m_y);
    return 0;
}

Double click to view unformatted code.


Back to problem 59