CSJ2K.j2k.util.MathUtil.lcm C# (CSharp) Метод

lcm() публичный статический Метод

Method that calculates the Least Common Multiple (LCM) of several positive integer numbers.
public static lcm ( int x ) : int
x int Array containing the numbers. /// ///
Результат int
        public static int lcm(int[] x)
        {
            if (x.Length < 2)
            {
                throw new System.InvalidOperationException("Do not use this method if there are less than" + " two numbers.");
            }
            int tmp = lcm(x[x.Length - 1], x[x.Length - 2]);
            for (int i = x.Length - 3; i >= 0; i--)
            {
                if (x[i] <= 0)
                {
                    throw new System.ArgumentException("Cannot compute the least " + "common multiple of " + "several numbers where " + "one, at least," + "is negative.");
                }
                tmp = lcm(tmp, x[i]);
            }
            return tmp;
        }

Same methods

MathUtil::lcm ( int x1, int x2 ) : int