Stan0033

Untitled

Apr 3rd, 2021
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace exam_preparation
  4. {
  5. class Program
  6. {
  7. static void Main()
  8. {
  9. string command = "";
  10. int Number_Of_Bad_Marks = Convert.ToInt32(Console.ReadLine());
  11.  
  12. int Mark;
  13. int Count_Bad_Marks = 0;
  14. double Average_Mark;
  15. int Problems_Solved = 0;
  16. int Count_Marks = 0;
  17. int Sum_Of_Makrs = 0;
  18. string Last_Problem;
  19. //-----------------------------------------------------
  20. //-----------------------------------------------------
  21. do
  22. {
  23.  
  24. Last_Problem = Console.ReadLine(); Problems_Solved++;
  25. Mark = Convert.ToInt32(Console.ReadLine()); Count_Marks++; Sum_Of_Makrs += Mark;
  26. if (Mark <= 4) { Count_Bad_Marks++; }
  27. if (Count_Bad_Marks == Number_Of_Bad_Marks) { break; }
  28.  
  29. } while (command != "Enough");
  30. //-----------------------------------------------------
  31. //-----------------------------------------------------
  32. if ( Count_Bad_Marks == Number_Of_Bad_Marks )
  33. {
  34. Console.WriteLine($"You need a break, {Number_Of_Bad_Marks} poor grades.");
  35. }
  36. else
  37. {
  38. if (command == "Enough")
  39. {
  40. Average_Mark = Convert.ToDouble(Sum_Of_Makrs) / Convert.ToDouble(Count_Marks);
  41. Console.WriteLine($"Average score: {Average_Mark.ToString("F2")}");
  42. Console.WriteLine($"Number of problems: {Problems_Solved}");
  43. Console.WriteLine($"Last problem: {Last_Problem}");
  44. }
  45. }
  46.  
  47.  
  48.  
  49. }
  50. }
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment