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


using System;

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

        int s = 0;
        int[,] a = new int[n, m];
        Console.WriteLine("Введите элем массива");
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                a[i, j] = int.Parse(Console.ReadLine());
            }
        }
        
        // Вывод матрицы на экран (как на фото)
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                Console.Write(a[i, j] + " ");
            }
            Console.WriteLine();
        }

        // ==========================================
        // ВАШЕ ЗАДАНИЕ: Найти количество элементов < ch
        // ==========================================
        Console.WriteLine("Введите число ch:");
        int ch = Convert.ToInt32(Console.ReadLine());
        
        int count = 0; // Переменная для подсчета количества

        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                if (a[i, j] < ch)
                {
                    count++;
                }
            }
        }
        
        Console.WriteLine("Количество элементов меньше " + ch + ": " + count);
        // ==========================================


        // Ваш старый код для поиска суммы (как на фото)
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                s += a[i, j];
            }
        }
        Console.WriteLine(s);
    }
}