Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exam_preparation
- {
- class Program
- {
- static void Main()
- {
- string command = "";
- int Number_Of_Bad_Marks = Convert.ToInt32(Console.ReadLine());
- int Mark;
- int Count_Bad_Marks = 0;
- double Average_Mark;
- int Problems_Solved = 0;
- int Count_Marks = 0;
- int Sum_Of_Makrs = 0;
- string Last_Problem;
- //-----------------------------------------------------
- //-----------------------------------------------------
- do
- {
- Last_Problem = Console.ReadLine(); Problems_Solved++;
- Mark = Convert.ToInt32(Console.ReadLine()); Count_Marks++; Sum_Of_Makrs += Mark;
- if (Mark <= 4) { Count_Bad_Marks++; }
- if (Count_Bad_Marks == Number_Of_Bad_Marks) { break; }
- } while (command != "Enough");
- //-----------------------------------------------------
- //-----------------------------------------------------
- if ( Count_Bad_Marks == Number_Of_Bad_Marks )
- {
- Console.WriteLine($"You need a break, {Number_Of_Bad_Marks} poor grades.");
- }
- else
- {
- if (command == "Enough")
- {
- Average_Mark = Convert.ToDouble(Sum_Of_Makrs) / Convert.ToDouble(Count_Marks);
- Console.WriteLine($"Average score: {Average_Mark.ToString("F2")}");
- Console.WriteLine($"Number of problems: {Problems_Solved}");
- Console.WriteLine($"Last problem: {Last_Problem}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment