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