Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Loops
- {
- class Program
- {
- static void Main(string[] args)
- {
- int people = int.Parse(Console.ReadLine());
- string fitness = Console.ReadLine();
- int backCounter = 0;
- int chestCounter = 0;
- int legsCounter = 0;
- int absCounter = 0;
- int protShake = 0;
- int protBar = 0;
- int workOutCounter = 0;
- int proteinCounter = 0;
- for (int i = 1; i <= people; i++)
- {
- if (fitness == "Back")
- {
- backCounter++;
- workOutCounter++;
- }
- else if (fitness == "Chest")
- {
- chestCounter++;
- workOutCounter++;
- }
- else if (fitness == "Legs")
- {
- legsCounter++;
- workOutCounter++;
- }
- else if (fitness == "Abs")
- {
- absCounter++;
- workOutCounter++;
- }
- else if (fitness == "Protein shake")
- {
- protShake++;
- proteinCounter++;
- }
- else
- {
- protBar++;
- proteinCounter++;
- }
- fitness = Console.ReadLine();
- }
- double percentWorkOut = workOutCounter * 1.0 / people * 100.0;
- double percentProtein = proteinCounter * 1.0 / people * 100.0;
- Console.WriteLine($"{backCounter} - back");
- Console.WriteLine($"{chestCounter} - chest");
- Console.WriteLine($"{legsCounter} - legs");
- Console.WriteLine($"{absCounter} - abs");
- Console.WriteLine($"{protShake} - protein shake");
- Console.WriteLine($"{protBar} - protein bar");
- Console.WriteLine($"{percentWorkOut:f2}% - work out");
- Console.WriteLine($"{percentProtein:f2}% - protein");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement