Krasimir_Slavov

Untitled

Nov 19th, 2018
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Exam_Wedding_Presents
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double guests = double.Parse(Console.ReadLine());
  14.             double gifts = double.Parse(Console.ReadLine());
  15.  
  16.             double catA = 0;
  17.             double catB = 0;
  18.             double catV = 0;
  19.             double catG = 0;
  20.  
  21.             for (int i = 0; gifts <= guests && i <= gifts; i++)
  22.             {
  23.                 string category = string.Empty;
  24.                 switch (category)
  25.                 {
  26.                     case "A": catA += catA; gifts--; break;
  27.                     case "B": catB += catB; gifts--; break;
  28.                     case "V": catV += catV; gifts--; break;
  29.                     case "G": catG += catG; gifts--; break;
  30.                 }
  31.  
  32.             }
  33.             Console.WriteLine($"{Math.Round(catA / gifts * 100.0):F2}%");
  34.             Console.WriteLine($"{Math.Round(catB / gifts * 100.0):F2}%");
  35.             Console.WriteLine($"{Math.Round(catV / gifts * 100.0):F2}%");
  36.             Console.WriteLine($"{Math.Round(catG / gifts * 100.0):F2}%");
  37.             Console.WriteLine($"{Math.Round(gifts / guests * 100.0):F2}%");
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment