petarkobakov

Football results

Feb 29th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace exam
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int wins = 0;
  10. int loses = 0;
  11. int drawns = 0;
  12.  
  13.  
  14. for (int game = 1; game <= 3; game++)
  15. {
  16. string score = Console.ReadLine();
  17. int left = int.Parse(score.Split(':')[0]);
  18. int right = int.Parse(score.Split(':')[1]);
  19. if (left > right)
  20. {
  21. wins++;
  22. }
  23. else if (left < right)
  24. {
  25. loses++;
  26. }
  27. else if (right == left)
  28. {
  29.  
  30. drawns++;
  31.  
  32. }
  33.  
  34.  
  35. }
  36. Console.WriteLine($"Team won {wins} games.");
  37. Console.WriteLine($"Team lost {loses} games.");
  38. Console.WriteLine($"Drawn games: {drawns}");
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment