Spocoman

04. Train The Trainers

Nov 22nd, 2021 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TraintheTrainers
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int jury = int.Parse(Console.ReadLine());
  10.             string presentation = Console.ReadLine();
  11.             double average = 0;
  12.             double averageTotal = 0;
  13.             int counter = 0;
  14.  
  15.             while (presentation != "Finish")
  16.             {
  17.                 for (int i = 1; i <= jury; i++)
  18.                 {
  19.                     double score = double.Parse(Console.ReadLine());
  20.                     average += score;
  21.                     if (jury == i)
  22.                     {
  23.                         Console.WriteLine($"{presentation} - {average / jury:F2}.");
  24.                         averageTotal += average;
  25.                         average = 0;
  26.                         break;
  27.                     }
  28.                 }
  29.                 counter++;
  30.                 presentation = Console.ReadLine();
  31.             }
  32.             Console.WriteLine($"Student's final assessment is {averageTotal / (counter * jury):F2}.");
  33.         }
  34.     }
  35. }
  36.  
Add Comment
Please, Sign In to add comment