Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace tESt
- {
- class Program
- {
- static void Main(string[] args)
- {
- var studentsNumber = double.Parse(Console.ReadLine()); // students number
- double scoreTop = 0; // Top
- double scoreGood = 0; // Good
- double scoreMidle = 0; // Middle
- double scoreFail = 0; // Fail
- double allStudents = 0;
- double topStudents = 0; // Top numbers
- double goodStudents = 0; // Good numbers
- double midleStudents = 0; // Middle numbers
- double failStudents = 0; // Fail numbers
- for (int i = 0; i < studentsNumber; i++)
- {
- var num = double.Parse(Console.ReadLine());
- allStudents = allStudents + 1;
- if (num >= 5.00) // Top
- {
- scoreTop = scoreTop + num;
- topStudents = topStudents + 1;
- }
- else if (num >= 4.00) // Good
- {
- scoreGood = scoreGood + num;
- goodStudents = goodStudents + 1;
- }
- else if (num >= 3.00) // Middle
- {
- scoreMidle = scoreMidle + num;
- midleStudents = midleStudents + 1;
- }
- else if (num < 3.00) // Fail
- {
- scoreFail = scoreFail + num;
- failStudents = failStudents + 1;
- }
- }
- var topPorcent = (topStudents / allStudents) * 100.0; // Top % (Porcentage)
- var goodPorcent = (goodStudents / allStudents) * 100.0; // Good % (Porcentage)
- var midlePorcent = (midleStudents / allStudents) * 100.0; // Middle % (Porcentage)
- var failPorcent = (failStudents / allStudents) * 100.0; // Fail % (Porcentage)
- var ScrowAll = (scoreTop + scoreGood + scoreMidle + scoreFail) / allStudents;
- Console.WriteLine($"Top students: {topPorcent:f2}%");
- Console.WriteLine($"Between 4.00 and 4.99: {goodPorcent:f2}%");
- Console.WriteLine($"Between 3.00 and 3.99: {midlePorcent:f2}%");
- Console.WriteLine($"Fail: {failPorcent:f2}%");
- Console.WriteLine( $"Average: {ScrowAll:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment