Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05.FootballTournament
- {
- class Program
- {
- static void Main(string[] args)
- {
- string team = Console.ReadLine();
- int numOfGames = int.Parse(Console.ReadLine());
- double winsCounter = 0;
- double drawsCounter = 0;
- double losesCounter = 0;
- double points = 0;
- for (int i = 1; i <= numOfGames; i++)
- {
- char winOrLose = char.Parse(Console.ReadLine());
- if (winOrLose == 'W')
- {
- winsCounter++;
- points += 3;
- }
- else if (winOrLose == 'D')
- {
- drawsCounter++;
- points += 1;
- }
- else
- {
- losesCounter++;
- }
- }
- if (numOfGames <= 0)
- {
- Console.WriteLine($"{team} hasn't played any games during this season.");
- }
- else if (numOfGames >= 1)
- {
- Console.WriteLine($"{team} has won {points} points during this season.");
- Console.WriteLine("Total stats:");
- Console.WriteLine($"## W: {winsCounter}");
- Console.WriteLine($"## D: {drawsCounter}");
- Console.WriteLine($"## L: {losesCounter}");
- Console.WriteLine($"Win rate: {(winsCounter * 100) / numOfGames:F2}%");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement