program:
#include<stdio.h>
int main()
{
int a, b, i, lcm, hcf;
printf("enter a:\n");
scanf("%d",&a);
printf("enter b:\n");
scanf("%d",&b);
for(i=1; i<=a && i<=b;i++)
{
if(a%i==0 && b%i==0)
{
hcf=i;
}
}
lcm= (a*b)/hcf;
printf("hcf of number is:%d", hcf);
printf("\nlcm of number is:%d", lcm);
return 0;
}
output: