SHARE
TWEET

Untitled

a guest Jun 3rd, 2017 144 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace test1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.  
  13.         {
  14.             double allseats = double.Parse(Console.ReadLine());
  15.             double allfans = double.Parse(Console.ReadLine());
  16.             double fansA = 0;
  17.             double fansB = 0;
  18.             double fansV = 0;
  19.             double fansG = 0;
  20.             for (int i = 0; i < allfans; i++)
  21.             {
  22.                 string sector = Console.ReadLine();
  23.  
  24.                 switch (sector)
  25.                 {
  26.                     case "A": fansA = fansA + 1; break;
  27.                     case "B": fansB = fansB + 1; break;
  28.                     case "V": fansV = fansV + 1; break;
  29.                     case "G": fansG = fansG + 1; break;
  30.                 }
  31.             }
  32.             fansA = (fansA/allfans) * 100;
  33.             fansB = (fansB / allfans) * 100;
  34.             fansV = (fansV / allfans) * 100;
  35.             fansG = (fansG / allfans) * 100;
  36.             allfans = (allfans / allseats) * 100;
  37.  
  38.             Console.WriteLine("{0:f2}%", fansA);
  39.             Console.WriteLine("{0:f2}%", fansB);
  40.             Console.WriteLine("{0:f2}%", fansV);
  41.             Console.WriteLine("{0:f2}%", fansG);
  42.             Console.WriteLine("{0:f2}%", allfans);
  43.         }
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top