Search (Article Or Program)

18 June 2011

L.C.M of Two Numbers (in C)

#include
#include
main()
{
clrscr();
printf("\t\t>>>>>>>>>>>>L.C.M of 2 Numbers<<<<<<<<<<\n\n");
int a,b,r,c,d,l;
printf("Enter no 1\n");
scanf("%d",&a);
printf("Enter no 2\n");
scanf("%d",&b);
c=a;
d=b;
while(b!=0)
{
r=a%b;
a=b;
b=r;
}
l=(c*d)/a;
printf("The result is %d",l);
getch();
}