Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace WeddingPresents
- {
- class Program
- {
- static void Main(string[] args)
- {
- int guests = int.Parse(Console.ReadLine());
- double presentsCount = double.Parse(Console.ReadLine());
- int aCount = 0;
- int bCount = 0;
- int vCount = 0;
- int gCount = 0;
- for (int i = 1; i <= presentsCount; i++)
- {
- string presentCategory = Console.ReadLine();
- if (presentCategory == "A")
- {
- aCount++;
- }
- else if (presentCategory == "B")
- {
- bCount++;
- }
- else if (presentCategory == "V")
- {
- vCount++;
- }
- else if (presentCategory == "G")
- {
- gCount++;
- }
- }
- double aPercent = (aCount / presentsCount) * 100;
- double bPercent = (bCount / presentsCount) * 100;
- double vPercent = (vCount / presentsCount) * 100;
- double gPercent = (gCount / presentsCount) * 100;
- double presentPercent = (presentsCount / guests) * 100;
- Console.WriteLine($"{aPercent:F2}%");
- Console.WriteLine($"{bPercent:F2}%");
- Console.WriteLine($"{vPercent:F2}%");
- Console.WriteLine($"{gPercent:F2}%");
- Console.WriteLine($"{presentPercent:F2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement