Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Channels;
- namespace StudentAcademy
- {
- class Program
- {
- public static void Main()
- {
- Dictionary<string, List<double>> studentGrades = new Dictionary<string, List<double>>();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string student = Console.ReadLine();
- double grade = double.Parse(Console.ReadLine());
- if (!studentGrades.ContainsKey(student))
- {
- studentGrades.Add(student, new List<double>());
- }
- studentGrades[student].Add(grade);
- }
- foreach (var student in studentGrades)
- {
- double studentAverage = student.Value.Average();
- if (studentAverage >= 4.50)
- {
- Console.WriteLine($"{student.Key} -> {studentAverage:f2}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement