bacco

Футболен турнир ; Football League

Feb 4th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Footbal
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var capacity = int.Parse(Console.ReadLine());
  10.  
  11.             var numbers  = double.Parse(Console.ReadLine());
  12.  
  13.             var A = 0;
  14.             var B = 0;
  15.             var V = 0;
  16.             var G = 0;
  17.  
  18.             for (int i = 0; i < numbers; i++)
  19.             {
  20.  
  21.                 var count = Console.ReadLine().ToLower();
  22.  
  23.                 if (count == "a")
  24.                 {
  25.                     A += 1;
  26.                 }
  27.                 if (count == "b")
  28.                 {
  29.                     B += 1;
  30.                 }
  31.                 if (count == "v")
  32.                 {
  33.                     V += 1;
  34.                 }
  35.                 if (count == "g")
  36.                 {
  37.                     G += 1;
  38.                 }
  39.             }
  40.             var porcentageA = A / numbers * 100;
  41.             Console.WriteLine($"{porcentageA:f2}%");
  42.  
  43.             var porcentageB = B / numbers * 100;
  44.             Console.WriteLine($"{porcentageB:f2}%");
  45.  
  46.             var porcentageV = V / numbers * 100;
  47.             Console.WriteLine($"{porcentageV:f2}%");
  48.  
  49.             var porcentageG = G / numbers * 100;
  50.             Console.WriteLine($"{porcentageG:f2}%");
  51.  
  52.  
  53.             var stadiumPorcentage = numbers / capacity * 100;
  54.             Console.WriteLine($"{stadiumPorcentage:f2}%");
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment