#include <stdio.h>
int main()
{
int a,b,c,d,temp,j,hcf;
printf("enter two numbers\n");
scanf("%d%d",&a,&b);
if(a>b)
temp=a;
else
temp=b;
for (j=1; j<=temp; j++)
{
c = a%j;
d = b%j;
if(c==0 && d==0)
hcf=j;
}
printf("\nLCM of %d and %d is %d\n",a,b,a*b/hcf);
return 0;
}
No comments:
Post a Comment