Advertisement
aneliabogeva

Untitled

Apr 2nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Best_Player
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string player = Console.ReadLine();
  10. string bestPlayer = "";
  11. int bestGoals = 0;
  12. bool madeHatTrick = false;
  13.  
  14. while (player != "END")
  15. {
  16. int goals = int.Parse(Console.ReadLine());
  17. if (goals > bestGoals)
  18. {
  19. bestGoals = goals;
  20. bestPlayer = player;
  21. }
  22. if (bestGoals >= 3)
  23. {
  24. madeHatTrick = true;
  25. }
  26. if (bestGoals >= 10)
  27. {
  28. break;
  29. }
  30. player = Console.ReadLine();
  31. }
  32.  
  33. Console.WriteLine($"{bestPlayer} is the best player!");
  34. if (madeHatTrick)
  35. {
  36. Console.WriteLine($"He has scored {bestGoals} goals and made a hat-trick !!!");
  37. }
  38. else
  39. {
  40. Console.WriteLine($"He has scored {bestGoals} goals.");
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement