Write a c program to find HCF and LCM for three numbers

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c,H,L;

printf(“Enter three integer : “);

scanf(“%d %d %d”,&a,&b,&c);

if(a<b)
{

for(H=(a=1;H–)
{

if(a%H==0 && c%H==0)

break;
}

printf(“HCF is:%d”,H);

}

if(b<a)
{

for(H=(b=1;H–)
{

if(b%H==0 && c%H==0)

break;
}

printf(“HCF is:%d”,H);
}
{
for(L=1;L<=abc;L++)

if(L%a==0 && L%b==0 && L%c==0)

break;
printf(“\nLCM is: %d”,L);
}
}

Leave a Comment