Advertisement
aneliabogeva

Untitled

Apr 3rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 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 name = Console.ReadLine();
  10. int numberOfGames = int.Parse(Console.ReadLine());
  11. int counter = 0;
  12. int goalsIn = 0;
  13. int goalsOut = 0;
  14. int points = 0;
  15. int totalGoalsOut = 0;
  16. int totalGoalsIn = 0;
  17.  
  18. while (counter < numberOfGames)
  19. {
  20. goalsOut = int.Parse(Console.ReadLine());
  21. goalsIn = int.Parse(Console.ReadLine());
  22.  
  23. if (goalsOut > goalsIn)
  24. {
  25. points += 3;
  26. }
  27. else if (goalsOut==goalsIn)
  28. {
  29. points += 1;
  30. }
  31. totalGoalsOut += goalsOut;
  32. totalGoalsIn += goalsIn;
  33. counter++;
  34. }
  35.  
  36. if (totalGoalsOut >= totalGoalsIn)
  37. {
  38. Console.WriteLine($"{name} has finished the group phase with {points} points.");
  39. Console.WriteLine($"Goal difference: {totalGoalsOut - totalGoalsIn}.");
  40. }
  41. else if (totalGoalsOut < totalGoalsIn)
  42. {
  43. Console.WriteLine($"{name} has been eliminated from the group phase.");
  44. Console.WriteLine($"Goal difference: {totalGoalsOut - totalGoalsIn}.");
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement