Advertisement
NewInCSharp

Untitled

Nov 28th, 2019
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 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. int back = 0;
  11. int chest = 0;
  12. int legs = 0;
  13. int abs = 0;
  14. int proteinShake = 0;
  15. int proteinBar = 0;
  16. int training = 0;
  17. int shopping = 0;
  18.  
  19. for (int i = 0; i < visitors; i++)
  20. {
  21. string activity = Console.ReadLine();
  22. if (activity == "Back")
  23. {
  24. back++;
  25. training++;
  26. }
  27. else if (activity == "Chest")
  28. {
  29. chest++;
  30. training++;
  31. }
  32. else if (activity == "Legs")
  33. {
  34. legs++;
  35. training++;
  36. }
  37. else if (activity == "Abs")
  38. {
  39. abs++;
  40. training++;
  41. }
  42. else if (activity == "Protein shake")
  43. {
  44. proteinShake++;
  45. shopping++;
  46. }
  47. else if (activity == "Protein bar")
  48. {
  49. proteinBar++;
  50. shopping++;
  51. }
  52. }
  53. double percentWorkOut = (training * 1.0) / (training + shopping) *100;
  54. double percentProtein = (shopping * 1.0) / (training + shopping) *100;
  55.  
  56. Console.WriteLine($"{back} - back");
  57. Console.WriteLine($"{chest} - chest");
  58. Console.WriteLine($"{legs} - legs");
  59. Console.WriteLine($"{abs} - abs");
  60. Console.WriteLine($"{proteinShake} - protein shake");
  61. Console.WriteLine($"{proteinBar} - protein bar");
  62. Console.WriteLine($"{percentWorkOut:f2}% - work out");
  63. Console.WriteLine($"{percentProtein:f2}% - protein");
  64.  
  65. }
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement