Advertisement
sanyakasarova

04. Train the Trainers

Jun 16th, 2021
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine()); // num of people in the jury
  8.  
  9. int countOfPresentations = 0;
  10. double totalSumOfGrades = 0;
  11.  
  12. string presentation = Console.ReadLine();
  13.  
  14. while (presentation != "Finish")
  15. {
  16. countOfPresentations++;
  17. double sumOfGrades = 0;
  18.  
  19. // for loop for the grades:
  20. for (int i = 0; i < n; i++)
  21. {
  22. double grade = double.Parse(Console.ReadLine());
  23. sumOfGrades += grade;
  24. }
  25. double averageGrade = sumOfGrades / n;
  26. Console.WriteLine($"{presentation} - {averageGrade:f2}.");
  27.  
  28. totalSumOfGrades += averageGrade;
  29.  
  30.  
  31. presentation = Console.ReadLine();
  32. }
  33.  
  34. Console.WriteLine($"Student's final assessment is {totalSumOfGrades/countOfPresentations:f2}.");
  35. }
  36.  
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement