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