Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05.FitnessCenter
- {
- class FitnessCenter
- {
- static void Main(string[] args)
- {
- int numPeople = int.Parse(Console.ReadLine());
- int back = 0;
- int chest = 0;
- int legs = 0;
- int abs = 0;
- int proteinShake = 0;
- int proteinBar = 0;
- double peopleTraining = 0.0;
- double peopleBuying = 0.0;
- double percentTraining = 0.0;
- double percentBuying = 0.0;
- for (int i = 1; i <= numPeople; i++)
- {
- string activity = Console.ReadLine();
- if (activity == "Back")
- {
- back++;
- }
- else if (activity == "Chest")
- {
- chest++;
- }
- else if (activity == "Legs")
- {
- legs++;
- }
- else if (activity == "Abs")
- {
- abs++;
- }
- else if (activity == "Protein shake")
- {
- proteinShake++;
- }
- else if (activity == "Protein bar")
- {
- proteinBar++;
- }
- }
- peopleTraining = back + chest + legs + abs;
- peopleBuying = numPeople - peopleTraining;
- percentTraining = (peopleTraining / numPeople) * 100;
- percentBuying = (peopleBuying / numPeople) * 100;
- Console.WriteLine($"{back} - back");
- Console.WriteLine($"{chest} - chest");
- Console.WriteLine($"{legs} - legs");
- Console.WriteLine($"{abs} - abs");
- Console.WriteLine($"{proteinShake} - protein shake");
- Console.WriteLine($"{proteinBar} - protein bar");
- Console.WriteLine($"{percentTraining:f2}% - work out");
- Console.WriteLine($"{percentBuying:f2}% - protein");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment