Advertisement
Icakman

ocenki, trudna

Nov 30th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int maxFail = int.Parse(Console.ReadLine());
  14. int fail = 0;
  15. int solved = 0;
  16. double gradesSum = 0;
  17. string last = "";
  18. bool isFailed = true;
  19.  
  20. while (fail < maxFail)
  21. {
  22. string name = Console.ReadLine();
  23. if ("Enough" == name)
  24. {
  25. isFailed = false;
  26. break;
  27. }
  28. int grade = int.Parse(Console.ReadLine());
  29. if (grade <= 4)
  30. {
  31. fail++;
  32. }
  33. gradesSum += grade;
  34. solved++;
  35. last = name;
  36. }
  37. if (isFailed)
  38. {
  39. Console.WriteLine($"Tup si. Imash {fail} greshki.");
  40. Console.WriteLine("Probvai pak tupson");
  41. }
  42. else
  43. {
  44. Console.WriteLine("Mn dobre maniashki!");
  45. Console.WriteLine($"sredniq ti e: {gradesSum/solved:F2}. Obshto reshi tolkoz: {solved}. Poslednata ti zadacha beshe: {last}.");
  46. }
  47.  
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement