Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exercise_Game_info
- {
- class Program
- {
- static void Main(string[] args)
- {
- string teamName = Console.ReadLine();
- int gamesPlayed = int.Parse(Console.ReadLine());
- double timePlayed = double.Parse(Console.ReadLine());
- double sumPlayed = 0;
- double averagePlayed = 0;
- int penaltiesGames = 0;
- int additionalGames = 0;
- for (int i = 1; i <= gamesPlayed; i++)
- {
- if (timePlayed > 90 && timePlayed <= 120)
- {
- additionalGames++;
- }
- else if (timePlayed > 120)
- {
- penaltiesGames++;
- }
- sumPlayed += timePlayed;
- averagePlayed = sumPlayed / gamesPlayed;
- }
- Console.WriteLine($"{teamName} has played {sumPlayed} minutes. Average minutes per game: {averagePlayed:F2}" +
- $"\nGames with penalties: {penaltiesGames}" +
- $"\nGames with additional time: {additionalGames}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment