Advertisement
Dianov

Nested Loops - Exercise (04. Train The Trainers)

Mar 4th, 2021
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 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 TrainTheTrainers
  8.  
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int jury = int.Parse(Console.ReadLine());
  15.             int presentationsCounter = 0;
  16.             decimal allScores = 0;
  17.  
  18.             bool isTrue = true;
  19.  
  20.             while (isTrue)
  21.             {
  22.  
  23.                 string presentationName = Console.ReadLine();
  24.  
  25.                 decimal scoreSum = 0;
  26.  
  27.  
  28.                 if (presentationName == "Finish")
  29.                 {
  30.                     isTrue = false;
  31.                     Console.WriteLine($"Student's final assessment is {(allScores / (jury * presentationsCounter)):F2}.");
  32.                     break;
  33.                 }
  34.                 presentationsCounter += 1;
  35.  
  36.                 for (int i = 0; i < jury; i++)
  37.                 {
  38.                     decimal score = decimal.Parse(Console.ReadLine());
  39.                     scoreSum += score;
  40.                     allScores += score;
  41.                 }
  42.                 Console.WriteLine($"{presentationName} - {(scoreSum / jury):F2}.");
  43.             }
  44.         }
  45.     }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement