SHARE
TWEET

Untitled

a guest Dec 15th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace WeddingPresents
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int guests = int.Parse(Console.ReadLine());
  10.             double presentsCount = double.Parse(Console.ReadLine());
  11.             int aCount = 0;
  12.             int bCount = 0;
  13.             int vCount = 0;
  14.             int gCount = 0;
  15.             for (int i = 1; i <= presentsCount; i++)
  16.             {
  17.                 string presentCategory = Console.ReadLine();
  18.  
  19.                 if (presentCategory == "A")
  20.                 {
  21.                     aCount++;
  22.  
  23.                 }
  24.                 else if (presentCategory == "B")
  25.                 {
  26.                     bCount++;
  27.                 }
  28.                 else if (presentCategory == "V")
  29.                 {
  30.                     vCount++;
  31.                 }
  32.                 else if (presentCategory == "G")
  33.                 {
  34.                     gCount++;
  35.                 }
  36.  
  37.             }
  38.             double  aPercent = (aCount / presentsCount) * 100;
  39.             double  bPercent = (bCount / presentsCount) * 100;
  40.             double  vPercent = (vCount / presentsCount) * 100;
  41.             double  gPercent = (gCount / presentsCount) * 100;
  42.             double  presentPercent = (presentsCount / guests) * 100;
  43.  
  44.             Console.WriteLine($"{aPercent:F2}%");
  45.             Console.WriteLine($"{bPercent:F2}%");
  46.             Console.WriteLine($"{vPercent:F2}%");
  47.             Console.WriteLine($"{gPercent:F2}%");
  48.             Console.WriteLine($"{presentPercent:F2}%");
  49.  
  50.            
  51.         }
  52.     }
  53. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top