Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BasketballTournament
- {
- class Program
- {
- static void Main(string[] args)
- {
- string nameOfTournament = Console.ReadLine();
- int winCounter = 0;
- int loseCounter = 0;
- int totalMatches = 0;
- while (nameOfTournament != "End of tournaments")
- {
- int NumberOfMatches = int.Parse(Console.ReadLine());
- totalMatches+= NumberOfMatches;
- for (int i = 1; i <= NumberOfMatches; i++)
- {
- int myPoints = int.Parse(Console.ReadLine());
- int enemyPoints = int.Parse(Console.ReadLine());
- if(myPoints > enemyPoints)
- {
- winCounter+=1;
- int diff = myPoints - enemyPoints;
- Console.WriteLine($"Game {i} of tournament {nameOfTournament}: win with {diff} points.");
- }
- else if(myPoints < enemyPoints)
- {
- loseCounter+=1;
- int diff = enemyPoints - myPoints;
- Console.WriteLine($"Game {i} of tournament {nameOfTournament}: lost with {diff} points.");
- }
- }
- nameOfTournament = Console.ReadLine();
- }
- int winPercent = (winCounter / totalMatches) * 100;
- int losePercent = (loseCounter / totalMatches) * 100;
- Console.WriteLine($"{winPercent:f2}% matches win");
- Console.WriteLine($"{losePercent:f2}% matches lost");
- }
- }
- }
Add Comment
Please, Sign In to add comment