Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Exam_Preparation
- {
- class Program
- {
- static void Main(string[] args)
- {
- int badGrades = int.Parse(Console.ReadLine());
- int count = 0;
- string problemName = Console.ReadLine();
- string lastProblem = "";
- int gradeSum = 0;
- int allGrades = 0;
- while (problemName != "Enough")
- {
- int currentGrade = int.Parse(Console.ReadLine());
- gradeSum++;
- allGrades += currentGrade;
- if (currentGrade <= 4)
- {
- count++;
- if (count == badGrades)
- {
- break;
- }
- }
- lastProblem = problemName;
- problemName = Console.ReadLine();
- }
- if (problemName == "Enough")
- {
- double averageScore = 1.0 * allGrades / gradeSum;
- Console.WriteLine($"Average score: {averageScore:F2}");
- Console.WriteLine($"Number of problems: {gradeSum}");
- Console.WriteLine($"Last problem: {lastProblem}");
- }
- else
- {
- Console.WriteLine($"You need a break, {count} poor grades.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement