LCM of two numbers

Algorithm

Input   Two integer a and b      
Output  GCD of a and b.      
complexity O(d) where d is the number of digits in the smaller number      
  
gcd(a, b)  
1 if (b = 0) then  
2    Return a  
3 else  
4    Return gcd(b, a mod b)  

Algorithm Description

LCM () function takes two parameter m and n as an integers.
If b=0 then gcd (Greatest common divisor) is a.
a and b are temporary variable.

C Code

//To Find LCM of two numbers
//Input : Any non zero integer number(s)

#include< stdio.h>
#include< conio.h>
#include< stdlib.h>
int main()
{
    int a,b,m,n,lcm=1,
    printf("Enter two numbers ");
    scanf("%d%d",&a,&b);
    printf("LCM of %d and %d is ",a,b);
    m=a;
    n=b;
    while(a!=b)
    { if (a< b)
      a=a+m;
      else
      b=b+n;  
    }
    printf("%d",a);
}