Загрузка данных


internal class Program
{
    static bool Proverka(int[,] a, int n, int m)
    {
        for (int j = 0; j < m; j++)
        {
            int positive = 0;
            int negative = 0;

            for (int i = 0; i < n; i++)
            {
                if (a[i, j] > 0)
                    positive++;

                if (a[i, j] < 0)
                    negative++;
            }

            if (positive == negative)
                return true;
        }

        return false;
    }

    static void Main(string[] args)
    {
        Console.WriteLine("Введите количество строк:");
        int n = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Введите количество столбцов:");
        int m = Convert.ToInt32(Console.ReadLine());

        int[,] a = new int[n, m];
        Random rnd = new Random();

        // Заполнение матрицы случайными числами
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                a[i, j] = rnd.Next(-10, 11);
            }
        }

        // Вывод матрицы
        Console.WriteLine("\nМатрица:");

        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                Console.Write($"{a[i, j],5}");
            }

            Console.WriteLine();
        }

        // Вызов метода
        if (Proverka(a, n, m))
            Console.WriteLine("Есть столбец с равным количеством положительных и отрицательных элементов");
        else
            Console.WriteLine("Нет такого столбца");

        Console.ReadKey();
    }
}