Advertisement
bokoto83

Тrain the trainers

Jul 15th, 2019
111
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Train_The_Trainers
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int people = int.Parse(Console.ReadLine());
  14.             double score = 0;
  15.             double counter = 0;
  16.  
  17.             while (true)
  18.             {
  19.                 string presentation = Console.ReadLine();
  20.                 double sumOfGrades = 0;
  21.  
  22.                 if (presentation == "Finish")
  23.                 {
  24.                     double scoreSum = score / counter;
  25.                     Console.WriteLine($"Student's final assessment is {scoreSum:f2}.");
  26.                     break;
  27.                 }
  28.                 for (int i = 0; i < people; i++)
  29.                 {
  30.                     double grade = double.Parse(Console.ReadLine());
  31.                     sumOfGrades += grade;
  32.                     score += grade;
  33.                     counter++;
  34.                 }
  35.                 double sumAfter = sumOfGrades / people;
  36.                 Console.WriteLine($"{presentation} - {sumAfter:f2}.");
  37.  
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement