title: LCM of two numbers
body: <p>I am getting wrong result for my LCM program. </p>
  
  <p>Ifirst find gcd of the numbers and then divide the product with gcd.</p>
  
  <pre><code>int gcd(int x, int y)
  {
    while(y != 0)
    {
      int save = y;
      y = x % y;
      x = save;
    }
    return y;
  }
  
  int lcm(int x, int y)
  {
    int prod = x * y;
    int Gcd = gcd(x,y);
    int lcm = prod / Gcd;
  
    return lcm;
  }
  </code></pre>
  
  <p>Any help much appreciated.</p>