Advertisement
aneliabogeva

Untitled

Apr 4th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 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 _Game_Statistic
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string name = Console.ReadLine();
  14. float numberOfGames = int.Parse(Console.ReadLine());
  15. int counter = 0;
  16. float totalMinutes = 0;
  17. int minutes = 0;
  18. int totalMinutswithPenalty = 0;
  19. int totalGamesWithAddTime = 0;
  20.  
  21. while (counter < numberOfGames)
  22. {
  23. minutes = int.Parse(Console.ReadLine());
  24.  
  25. if (minutes > 120)
  26. {
  27. totalMinutswithPenalty += 1;
  28. }
  29. else if (minutes > 90 && minutes <= 120)
  30. {
  31. totalGamesWithAddTime += 1;
  32. }
  33.  
  34. totalMinutes += minutes;
  35. counter++;
  36. }
  37. double avarage = totalMinutes / numberOfGames;
  38.  
  39. Console.WriteLine($"{name} has played {totalMinutes} minutes. Average minutes per game: {avarage:f2}");
  40. Console.WriteLine($"Games with penalties: {totalMinutswithPenalty}");
  41. Console.WriteLine($"Games with additional time: {totalGamesWithAddTime}");
  42.  
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement