Advertisement
Guest User

Untitled

a guest
Sep 1st, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 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 ConsoleApp2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int capacitetOfStadium = int.Parse(Console.ReadLine());
  14. int countOfFens = int.Parse(Console.ReadLine());
  15.  
  16. string A = "A";
  17. string B = "B";
  18. string V = "V";
  19. string G = "G";
  20.  
  21. int fensSectorA = 0;
  22. int fensSectorB = 0;
  23. int fensSectorV = 0;
  24. int fensSectorG = 0;
  25.  
  26. for (int i = 0; i < countOfFens; i++)
  27. {
  28. string sector = Console.ReadLine();
  29.  
  30. if (sector == A)
  31. {
  32. fensSectorA += 1;
  33. }
  34. else if (sector == B)
  35. {
  36. fensSectorB += 1;
  37. }
  38. else if (sector == V)
  39. {
  40. fensSectorV += 1;
  41. }
  42. else if (sector == G)
  43. {
  44. fensSectorG += 1;
  45. }
  46. }
  47.  
  48. double percentA = fensSectorA / countOfFens * 100;
  49. double percentB = fensSectorB / countOfFens * 100;
  50. double percentV = fensSectorV / countOfFens * 100;
  51. double percentG = fensSectorG / countOfFens * 100;
  52. double percentCapacitet = countOfFens / capacitetOfStadium * 100;
  53.  
  54. Console.WriteLine($"{percentA}%");
  55. Console.WriteLine($"{percentB}%");
  56. Console.WriteLine($"{percentV}%");
  57. Console.WriteLine($"{percentG}%");
  58. Console.WriteLine($"{percentCapacitet}%");
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement