Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exam_Preparation
- {
- class Program
- {
- static void Main(string[] args)
- {
- int badGradeLimit = int.Parse(Console.ReadLine());
- int badGradeCount = 0;
- double problemCount = 0;
- double gradeSum = 0;
- string problemName = string.Empty;
- string lastProblemName = string.Empty;
- while (badGradeCount < badGradeLimit)
- {
- problemName = Console.ReadLine();
- if (problemName == "Enough")
- {
- break;
- }
- double grade = int.Parse(Console.ReadLine());
- gradeSum += grade;
- if (grade > 4)
- {
- lastProblemName = problemName;
- }
- else
- {
- badGradeCount++;
- }
- problemCount++;
- }
- if (badGradeCount < badGradeLimit && lastProblemName != "Enough")
- {
- Console.WriteLine($"Average score: {(gradeSum) / problemCount:f2}");
- Console.WriteLine($"Number of problems: {problemCount}");
- Console.WriteLine($"Last problem: {lastProblemName}");
- }
- if (badGradeCount == badGradeLimit)
- {
- Console.WriteLine($"You need a break, {badGradeLimit} poor grades.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment