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 ExamPreparation
- {
- class Program
- {
- static void Main(string[] args)
- {
- int possibleBadGrades = int.Parse(Console.ReadLine());
- int badGradesCount = 0;
- int total = 0;
- double sum = 0;
- string lastProblem =string.Empty;
- while (badGradesCount < possibleBadGrades)
- {
- string command = Console.ReadLine();
- int grade = int.Parse(Console.ReadLine());
- if (command=="Enough")
- {
- break;
- }
- int currentGrade = int.Parse(Console.ReadLine());
- lastProblem = command;
- total++;
- sum += currentGrade;
- if (currentGrade<=4)
- {
- badGradesCount++;
- }
- }
- if (badGradesCount==possibleBadGrades)
- {
- Console.WriteLine($"You need a break, {badGradesCount} poor grades.");
- }
- else
- {
- double average = sum / total;
- Console.WriteLine($"Average score: {average:f2}");
- Console.WriteLine($"Number of problem: {total}");
- Console.WriteLine($"Last problem: {lastProblem}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment