GCD of 2 numbers

18 Sep 2017
Following euclidean algorithm can find GCD of two integer numbers
static int GCD(int n, int m)
{
  a = Math.Max(n, m);
  b = Math.Min(n, m);
  int r;
  while (b != 0)
  {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}