Krasimir_Slavov

Untitled

Nov 18th, 2018
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 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. int guests = int.Parse(Console.ReadLine());
  14. int gifts = int.Parse(Console.ReadLine());
  15.  
  16. string category = string.Empty;
  17. int catA = 0;
  18. int catB = 0;
  19. int catV = 0;
  20. int catG = 0;
  21.  
  22. for (int i = 0; gifts <= guests && i <= gifts; i++)
  23. {
  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. Console.WriteLine($"{Math.Truncate(catA / gifts * 100.00):F2}%");
  33. Console.WriteLine($"{Math.Truncate(catB / gifts * 100.00):F2}%");
  34. Console.WriteLine($"{Math.Truncate(catV / gifts * 100.00):F2}%");
  35. Console.WriteLine($"{Math.Truncate(catG / gifts * 100.00):F2}%");
  36. Console.WriteLine($"{Math.Truncate(gifts / guests * 100.00):F2}%");
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment