Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SoftUni_Camp
- {
- class Program
- {
- static void Main(string[] args)
- {
- int countGroups = int.Parse(Console.ReadLine());
- int countCar = 0;
- int countMicrobus = 0;
- int countSmallBus = 0;
- int countBigBus = 0;
- int countTrain = 0;
- // int wholePeople = 0;
- for (int i = 0; i < countGroups; i++)
- {
- int countPeopleInGroup = int.Parse(Console.ReadLine());
- // wholePeople += countPeopleInGroup;
- if (countPeopleInGroup <= 5)
- {
- countCar += countPeopleInGroup;
- }
- else if (countPeopleInGroup >= 6 && countPeopleInGroup <= 12)
- {
- countMicrobus += countPeopleInGroup;
- }
- else if (countPeopleInGroup >= 13 && countPeopleInGroup <= 25)
- {
- countSmallBus += countPeopleInGroup;
- }
- else if (countPeopleInGroup >= 26 && countPeopleInGroup <= 40)
- {
- countBigBus += countPeopleInGroup;
- }
- else if (countPeopleInGroup >= 41)
- {
- countTrain += countPeopleInGroup;
- }
- }
- int wholePeople = countCar + countMicrobus + countSmallBus + countBigBus + countTrain;
- //Car
- // double percentageCar = 0;
- // percentageCar = countCar / wholePeople * 100;
- Console.WriteLine("{0:F2}%",(double) countCar / wholePeople*100);
- //Microbus
- //double percentageMicrobus = countMicrobus / wholePeople * 100;
- Console.WriteLine("{0:F2}%", (double)countMicrobus / wholePeople *100);
- //SmallBus
- // double percentageSmallBus = countSmallBus / wholePeople * 100;
- Console.WriteLine("{0:F2}%", (double) countSmallBus / wholePeople *100);
- //BigBus
- // double percentageBigBus = countBigBus / wholePeople * 100;
- Console.WriteLine("{0:F2}%", (double)countBigBus / wholePeople *100);
- //Train
- // double percentageTrain = countTrain / wholePeople * 100;
- Console.WriteLine("{0:F2}%", (double)countTrain / wholePeople *100);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement