Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Train_the_Trainers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- decimal grade = 0.0m;
- decimal avg = 0.0m;
- decimal avgGrade = 0.0m;
- int Nstudents = 0;
- string input = string.Empty;
- string subject = string.Empty;
- while (input != "Finish")
- {
- subject = Console.ReadLine();
- avgGrade = 0;
- if (input == "Finish" || subject == "Finish")
- {
- break;
- }
- for (int i = 0; i < n; i++)
- {
- input = Console.ReadLine();
- grade = decimal.Parse(input);
- avgGrade += grade / n;
- avg += grade;
- Nstudents++;
- }
- Console.WriteLine($"{subject:f2} - {avgGrade:f2}.");
- }
- avg /= Nstudents;
- Console.WriteLine($"Student's final assessment is {avg:f2}.");
- }
- }
- }
Add Comment
Please, Sign In to add comment