/// <summary> /// Taking GCM of parametr's array. Return GCM and time. /// </summary> /// <param name="compliteTime">Time of complitting</param> /// <param name="array">Array of numbers</param> /// <returns></returns> public static int GCMTime(out Stopwatch compliteTime, params int[] array) { compliteTime = new Stopwatch(); compliteTime.Start(); int result = GCMs.GCM(array); compliteTime.Stop(); return(result); }
/// <summary> /// Taking GCM of difference count of numbers by Eyklid algorithm /// </summary> /// <param name="array">Array of numbers</param> /// <returns></returns> public static int GCM(params int[] array) { if (array.Length <= 1) { Console.WriteLine("Wrong number of paramets."); return(0); } int result = GCMs.GCM(array[0], array[1]); for (int index = 2; index < array.Length && result != 1; index++) { result = GCMs.GCM(result, array[index]); } return(result); }