I am new in this programming field,so i am facing a lots of problem while writing code.My question is to find hcf and lcm of 3 integers given by the user....I got stucked at half, so please help me to complete this code, I know how to calculate hcf but i don't get any idea to calculate lcm in same program.
#include<stdio.h>
#include<conio.h>
void main()
{
int i,min,a,b,c,hcf,lcm;
printf("Enter three numbers :");
scanf("%d%d%d", &a,&b,&c);
min = a;
if(b<min)
{
min = b;
}
if(c<min)
{
min = c;
}
for(i=min ; i>=1; i--)
{
if(a%i==0 && b%i==0 && c%i==0)
{
hcf = i;
break;
}
}
printf("HCF is %d",hcf);
lcm =
printf("\nLCM is %d",lcm);
getch();
}