Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 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 ConsoleApp1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int A = 0;
  14. int B = 0;
  15. int V = 0;
  16. int G = 0;
  17. int afafa = 0;
  18.  
  19. int guests = int.Parse(Console.ReadLine());
  20. int gifts = int.Parse(Console.ReadLine());
  21. for (int i = 0; i < gifts; i++)
  22. {
  23. String command = Console.ReadLine();
  24. if (command == "A")
  25. {
  26. A += 1;
  27. }
  28. else if (command == "B")
  29. {
  30. B += 1;
  31. }
  32. else if (command == "V")
  33. {
  34. V += 1;
  35. }
  36. else if (command == "G")
  37. {
  38. G += 1;
  39. }
  40. else {
  41. afafa++;
  42. }
  43.  
  44. }
  45. double Aperct = A / gifts * 100.0;
  46. double Bperct = B / gifts * 100.0;
  47. double Vperct = V / gifts * 100.0;
  48. double Gperct = G / gifts * 100.0;
  49. double afaPerc = afafa / gifts * 100.0;
  50.  
  51.  
  52. Console.WriteLine($"{Aperct:f2}%");
  53. Console.WriteLine($"{Bperct:f2}%");
  54. Console.WriteLine($"{Vperct:f2}%");
  55. Console.WriteLine($"{Gperct:f2}%");
  56. Console.WriteLine($"{afaPerc:f2}%");
  57.  
  58. double countGuests = gifts / guests * 100.0;
  59. Console.WriteLine($"{countGuests:f2}%");
  60.  
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement