SHARE
TWEET

Untitled

a guest Apr 20th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace _05._Wedding_Presents
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int guests = int.Parse(Console.ReadLine());
  10.             int presentsCount = int.Parse(Console.ReadLine());
  11.             int ACounter = 0;
  12.             int BCounter = 0;
  13.             int VCounter = 0;
  14.             int GCounter = 0;
  15.  
  16.             for (int i = 0; i < presentsCount; i++)
  17.             {
  18.                 string presentCategory = Console.ReadLine();
  19.                 if (presentCategory == "A")
  20.                 {
  21.                     ACounter++;
  22.                 }
  23.                 else if (presentCategory == "B")
  24.                 {
  25.                     BCounter++;
  26.                 }
  27.                 else if (presentCategory == "V")
  28.                 {
  29.                     VCounter++;
  30.                 }
  31.                 else if (presentCategory == "G")
  32.                 {
  33.                     GCounter++;
  34.                 }
  35.             }
  36.             double percentA = (ACounter / presentsCount) * 100;
  37.             double percentB = (BCounter / presentsCount) * 100;
  38.             double percentV = (VCounter / presentsCount) * 100;
  39.             double percentG = (GCounter / presentsCount) * 100;
  40.             double all = (presentsCount / guests) * 100;
  41.  
  42.             Console.WriteLine($"{percentA:F2} %");
  43.             Console.WriteLine($"{percentB:F2} %");
  44.             Console.WriteLine($"{percentV:F2} %");
  45.             Console.WriteLine($"{percentG:F2} %");
  46.             Console.WriteLine($"{all:f2} %");
  47.         }
  48.     }
  49. }
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