Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace NestedLoops
- {
- class Program
- {
- static void Main(string[] args)
- {
- int countJudges = int.Parse(Console.ReadLine());
- //четем презентации, докато не получим Finish
- //текст -> Finish или име на презентация
- //stop: text == "Finish" -> continue: text != "Finish"
- string text = Console.ReadLine();
- double totalSum = 0; //сбора от всички оценки за всички презентации
- int countGrades = 0; // ОБЩ БРОЙ НА ОЦЕНКИТЕ ОТ ВСИЧКИ ПРЕЗЕНТАЦИИ
- while (text != "Finish")
- { //име на презентация -> text
- //получим оценки от всеки един член на журито
- double sum = 0; //сума от оценките за текущата презентация
- for (int judge = 1; judge <= countJudges; judge++)
- {
- double grade = double.Parse(Console.ReadLine());
- sum += grade;
- totalSum += grade;
- countGrades++;
- }
- //изчислим средната оценка -> сумата за оценките от текущата презентация
- double average = sum / countJudges;
- //печатаме
- Console.WriteLine($"{text} - {average:F2}.");
- text = Console.ReadLine();
- }
- double averageForAll = totalSum / countGrades;
- Console.WriteLine($"Student's final assessment is {averageForAll:F2}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement