NewInCSharp

Untitled

Nov 28th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Fitness_Center
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int visitors = int.Parse(Console.ReadLine());
  10. string activity = Console.ReadLine();
  11. int totalTraining = 0;
  12.  
  13.  
  14. int back = 0;
  15. int chest = 0;
  16. int legs = 0;
  17. int abs = 0;
  18. int proteinShake = 0;
  19. int proteinBar = 0;
  20. int workout = 0;
  21. int protein = 0;
  22.  
  23. for (int i = 1; i <= visitors; i++)
  24. {
  25. activity = Console.ReadLine();
  26. if (activity == "Back")
  27. {
  28. back++;
  29. totalTraining++;
  30. }
  31. if (activity == "Chest")
  32. {
  33. chest++;
  34. totalTraining++;
  35. }
  36. if (activity == "Legs")
  37. {
  38. legs++;
  39. totalTraining++;
  40. }
  41. if (activity == "Abs")
  42. {
  43. abs++;
  44. totalTraining++;
  45. }
  46. if (activity == "Protein shake")
  47. {
  48. proteinShake++;
  49.  
  50. }
  51. if (activity == "Protein bar")
  52. {
  53. proteinBar++;
  54.  
  55. }
  56. if (activity == "Work out")
  57. {
  58. workout += workout;
  59.  
  60. }
  61. if (activity == "Protein")
  62. {
  63. protein++;
  64.  
  65. }
  66. }
  67. double percent = (totalTraining * 1.0 / visitors) * 100;
  68. double percentPerProtein = (protein * 1.0 / visitors) * 100;
  69.  
  70.  
  71.  
  72. Console.WriteLine($"{back} - back");
  73. Console.WriteLine($"{chest} - chest");
  74. Console.WriteLine($"{legs} - legs");
  75. Console.WriteLine($"{abs} - abs");
  76. Console.WriteLine($"{proteinShake} - protein shake");
  77. Console.WriteLine($"{proteinBar} - protein bar");
  78. Console.WriteLine($"{percent:f2}% - work out");
  79. Console.WriteLine($"{percentPerProtein:f2}% - protein");
  80.  
  81. }
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment