Krasimir_Slavov

Untitled

Dec 1st, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 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 Exercise_Game_info
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string teamName = Console.ReadLine();
  14. int gamesPlayed = int.Parse(Console.ReadLine());
  15.  
  16. double timePlayed = double.Parse(Console.ReadLine());
  17.  
  18. double sumPlayed = 0;
  19. double averagePlayed = 0;
  20. int penaltiesGames = 0;
  21. int additionalGames = 0;
  22.  
  23. for (int i = 1; i <= gamesPlayed; i++)
  24. {
  25. if (timePlayed > 90 && timePlayed <= 120)
  26. {
  27. additionalGames++;
  28. }
  29. else if (timePlayed > 120)
  30. {
  31. penaltiesGames++;
  32. }
  33. sumPlayed += timePlayed;
  34. averagePlayed = sumPlayed / gamesPlayed;
  35. }
  36. Console.WriteLine($"{teamName} has played {sumPlayed} minutes. Average minutes per game: {averagePlayed:F2}" +
  37. $"\nGames with penalties: {penaltiesGames}" +
  38. $"\nGames with additional time: {additionalGames}");
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment