static void Main(string[] args) { int n; Random rand = new Random(); n = rand.Next(5, 16); List<GeometricProgression> gplist = new List<GeometricProgression>(); GeometricProgression gp; do { gp = new GeometricProgression(rand.Next(0, 11), rand.Next(0, 6)); } while (gp.Increment == 0); Console.WriteLine("Главная прогрессия: " + gp.GetInfo()); Console.WriteLine("Созданные прогрессии:"); for (int i = 0; i < n; i++) { gplist.Add(new GeometricProgression(rand.Next(0, 11), rand.Next(0, 6))); Console.WriteLine((i + 1) + ". " + gplist[i].GetInfo()); } int step = rand.Next(3, 16); Console.WriteLine("\nПрогрессии, у которых элемент с номером " + step +" больше соответствующего элемента главной прогрессии:"); for (int i = 0; i < n; i++) { if (gplist[i][step] > gp[step]) { Console.WriteLine((i + 1) + ". " + gplist[i].GetInfo() + " Sum("+step+") = "+gplist[i].GetSum(step)); } } }
public static void Main(string[] args) { Console.Clear(); ISeries progression = new ArithmeticalProgression(2, 2); Console.WriteLine("Progression:"); PrintSeries(progression); ISeries list = new List(new double[] { 5, 8, 6, 3, 1 }); Console.WriteLine("List:"); PrintSeries(list); ISeries progression2 = new GeometricProgression(2, 2); Console.WriteLine("Progression:"); PrintSeries(progression2); Console.WriteLine(progression[1].ToString()); }