Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Grades
- {
- class Program
- {
- static void Main(string[] args)
- {
- int student = int.Parse(Console.ReadLine());
- double grade3 = 0;
- double grade4 = 0;
- double grade5 = 0;
- double grade6 = 0;
- double gradeSum = 0;
- for (int i = 0; i < student; i++)
- {
- double grade = double.Parse(Console.ReadLine());
- if (grade >= 5)
- {
- grade6++;
- }
- else if (grade >= 4)
- {
- grade5++;
- }
- else if (grade >= 3)
- {
- grade4++;
- }
- else if (grade >= 2)
- {
- grade3++;
- }
- gradeSum += grade;
- }
- double average = gradeSum / student;
- Console.WriteLine($"Top students: {grade6 / student * 100:f2}%");
- Console.WriteLine($"Between 4.00 and 4.99: {grade5 / student * 100:f2}%");
- Console.WriteLine($"Between 3.00 and 3.99: {grade4 / student * 100:f2}%");
- Console.WriteLine($"Fail: {grade3 / student * 100:f2}%");
- Console.WriteLine($"Average: {average:f2}");
- }
Add Comment
Please, Sign In to add comment