Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
1.0 kB
0
Indexable
Never
 static void Main(string[] args)
        {

            string[] students = { "Васил", "Елена", "Божидар" };
            string[] subjects = { "Бел", "Мат", "ИТ", "Анг" };
            int[,] arr = new int[students.Length, subjects.Length];



            for (int i = 0; i < students.Length; i++)
            {
                Console.WriteLine("Въведи оценки за " + students[i]);
                for (int j = 0; j < subjects.Length; j++)
                {
                    Console.Write(subjects[j] + ": ");
                    arr[i, j] = int.Parse(Console.ReadLine());
                }
            }
            for (int j = 0; j < subjects.Length; j++) { 
                int sum = 0;
                for (int i = 0; i < students.Length; i++)
                sum += arr[i, j];
                 Console.WriteLine("Среден успех по {0} {1:f2}", subjects[j], (double)sum / students.Length);
             }

        }