Advertisement
Guest User

FootballLeague

a guest
Oct 21st, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FootballLeague
  4. {
  5.     class FootballLeague
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int stadionCapacy = int.Parse(Console.ReadLine());
  10.             int totalFens = int.Parse(Console.ReadLine());
  11.            
  12.             double sectorA = 0;
  13.             double sectorB = 0;
  14.             double sectorV = 0;
  15.             double sectorG = 0;
  16.            
  17.             for (int sector = totalFens - 1; sector >= 0; sector--)
  18.             {
  19.                
  20.                 string currentFenSector = Console.ReadLine();
  21.                 if (currentFenSector == "A")
  22.                 {
  23.                     sectorA++;
  24.                 }
  25.                 else if (currentFenSector == "B")
  26.                 {
  27.                     sectorB ++;
  28.                 }
  29.                 else if (currentFenSector == "V")
  30.                 {
  31.                     sectorV ++;
  32.                 }
  33.                 else // sector "G";
  34.                 {
  35.                     sectorG ++;
  36.                 }
  37.             }
  38.             Console.WriteLine($"{((sectorA / totalFens) * 100):F2}%");
  39.             Console.WriteLine($"{((sectorB / totalFens) * 100):F2}%");
  40.             Console.WriteLine($"{((sectorV / totalFens) * 100):F2}%");
  41.             Console.WriteLine($"{((sectorG / totalFens) * 100):F2}%");
  42.             Console.WriteLine($"{(((sectorA + sectorB + sectorG + sectorV) / stadionCapacy) * 100):F2}%");
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement