Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         double kapacitetStadion = double.Parse(Console.ReadLine());
  7.         double broiNaVsichkiFenove = double.Parse(Console.ReadLine());
  8.         string sector = "null";
  9.         double secA = 0;
  10.         double secB = 0;
  11.         double secV = 0;
  12.         double secG = 0;
  13.         for (int i = 0; i < broiNaVsichkiFenove; i++)
  14.         {
  15.             sector = Console.ReadLine();
  16.             if (sector == "A")
  17.             {
  18.                 secA += 1;
  19.             }
  20.             else if (sector == "B")
  21.             {
  22.                 secB += 1;
  23.             }
  24.             else if (sector == "V")
  25.             {
  26.                 secV += 1;
  27.             }
  28.             else if (sector == "G")
  29.             {
  30.                 secG += 1;
  31.             }
  32.         }
  33.         secA = secA / broiNaVsichkiFenove * 100;
  34.         secB = secB / broiNaVsichkiFenove * 100;
  35.         secV = secV / broiNaVsichkiFenove * 100;
  36.         secG = secG / broiNaVsichkiFenove * 100;
  37.         double fenoveSprqmoStadion = broiNaVsichkiFenove / kapacitetStadion * 100;
  38.  
  39.         Console.WriteLine("{0:F2}%", secA);
  40.         Console.WriteLine("{0:F2}%", secB);
  41.         Console.WriteLine("{0:F2}%", secV);
  42.         Console.WriteLine("{0:F2}%", secG);
  43.         Console.WriteLine("{0:F2}%", fenoveSprqmoStadion);
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement