#include<stdio.h>
#include<conio.h>
main()
{
int a,b,r,c,d;
clrscr();
printf("\n enter two value a & b=");
scanf("\n %d%d",&a,&b);
c=a*b;
r=b%a;
while(r!=0)
{
b=a;
a=r;
r=b%a;
}
printf("\n hcf=%d",a);
d=c/a;
printf("\n lcm=%d",d);
getch();
}
output:-enter two value=12
36
hcf=12
lcm=36
No comments:
Post a Comment