#include <stdio.h>
int main()
{
    int n1, n2, i, gcd,lcm,hcf;
    printf("Enter two integers:\n");
    scanf("%d %d", &n1, &n2);
    for(i=1; i <= n1 && i <= n2; ++i)
    {
        if(n1%i==0 && n2%i==0)
            gcd = i;
            hcf=gcd;
    }
    lcm=(n1*n2)/gcd;
    printf("Lcm of %d and %d =%d\n",n1,n2,lcm);
    printf("Hcf of %d and %d =%d\n",n1,n2,hcf);
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: