using System.Collections.Generic;
using System.Threading.Tasks;
public static void ShowArray(int[] a)
foreach (int number in a)
Console.Write(number + ";" + " ");
public static void ShowResult(int a)
public static int GetNegativeElements(int[] a)
for (int i = 0; i < a.Length; i++)
if (a[i] < 0) countNegative = countNegative + 1;
public static int GetMinValue(int[] a)
for (int i = 1; i < a.Length; i++)
if (a[i] < minValue) minValue = a[i];
public static int GetMaxValue(int[] a)
for (int i = 0; i < a.Length; i++)
if (a[i] > maxValue) maxValue = a[i];
public static int GetElementsQuantity(int[] a)
for (int i = 0; i < a.Length; i++)
public static void ReverseArray(int[] a)
for (int i = 0; i < a.Length / 2; i++, j--)
public static int CountElementsSum(int[] a)
for (int i = 0; i < a.Length; i++)
public static bool IsEven (int a)
public static int [] Filter (int[] array, int filteredLength, Func <int, bool> checkElement)
int[] newMas = new int[filteredLength];
for (int i = 0, j = 0; i < array.Length; i++)
if (checkElement(array [i] ))
public static int GetEvenNumbersCount(int[] a)
for (int i=0; i<a.Length; i++)
if (a[i] % 2 == 0) count++;
public static void Main(string[] args)
Random rnd = new Random();
Random rndValue = new Random();
int arrayLength = rnd.Next(5,21);
Console.WriteLine("Количество элементов в массиве: " + arrayLength);
int[] numbers = new int[arrayLength];
for (int i = 0; i < numbers.Length; i++)
numbers[i] = rndValue.Next(-100, 101);
Methods.ShowArray(numbers);
Methods.ShowResult(Methods.GetNegativeElements(numbers));
Methods.ShowResult(Methods.GetMinValue(numbers));
Methods.ShowResult(Methods.GetMaxValue(numbers));
Methods.ShowResult(Methods.GetElementsQuantity(numbers));
Methods.ReverseArray(numbers);
Methods.ShowArray(numbers);
int positiveCount = Methods.GetElementsQuantity(numbers) - Methods.GetNegativeElements(numbers);
Methods.Filter(numbers, Methods.GetEvenNumbersCount(numbers), Methods.IsEven);
Methods.Filter(numbers, positiveCount, a => a >= 0);