Advertisement
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 _Game_Statistic
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- float numberOfGames = int.Parse(Console.ReadLine());
- int counter = 0;
- float totalMinutes = 0;
- int minutes = 0;
- int totalMinutswithPenalty = 0;
- int totalGamesWithAddTime = 0;
- while (counter < numberOfGames)
- {
- minutes = int.Parse(Console.ReadLine());
- if (minutes > 120)
- {
- totalMinutswithPenalty += 1;
- }
- else if (minutes > 90 && minutes <= 120)
- {
- totalGamesWithAddTime += 1;
- }
- totalMinutes += minutes;
- counter++;
- }
- double avarage = totalMinutes / numberOfGames;
- Console.WriteLine($"{name} has played {totalMinutes} minutes. Average minutes per game: {avarage:f2}");
- Console.WriteLine($"Games with penalties: {totalMinutswithPenalty}");
- Console.WriteLine($"Games with additional time: {totalGamesWithAddTime}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement