Advertisement
aggressiveviking

Untitled

Feb 16th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04.TrainTheTrainers
  4. {
  5.     class TrainTheTrainers
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int numberOfPeople = int.Parse(Console.ReadLine());
  10.             double allScore = 0;
  11.             double counter = 0;
  12.  
  13.             while (true)
  14.             {
  15.                 string nameOfPresentation = Console.ReadLine();
  16.                 double sumOfGrades = 0;
  17.  
  18.                 if (nameOfPresentation == "Finish")
  19.                 {
  20.                     double scoreSum = allScore / counter;
  21.                     Console.WriteLine($"Student's final assessment is {scoreSum:f2}.");
  22.                     break;
  23.                 }
  24.  
  25.                 for (int i = 0; i < numberOfPeople; i++)
  26.                 {
  27.                     double grade = double.Parse(Console.ReadLine());
  28.                     sumOfGrades += grade;
  29.                     allScore += grade;
  30.                     counter++;
  31.                 }
  32.                 double sumAfter = sumOfGrades / numberOfPeople;
  33.                 Console.WriteLine($"{nameOfPresentation} - {sumAfter:f2}.");
  34.  
  35.             }
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement