Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SoftUni_Camp
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int countGroups = int.Parse(Console.ReadLine());
  14.             int countCar = 0;
  15.             int countMicrobus = 0;
  16.             int countSmallBus = 0;
  17.             int countBigBus = 0;
  18.             int countTrain = 0;
  19.            // int wholePeople = 0;
  20.  
  21.             for (int i = 0; i < countGroups; i++)
  22.             {
  23.                 int countPeopleInGroup = int.Parse(Console.ReadLine());
  24.                // wholePeople += countPeopleInGroup;
  25.  
  26.                 if (countPeopleInGroup <= 5)
  27.                 {
  28.                     countCar += countPeopleInGroup;
  29.                 }
  30.  
  31.                 else if (countPeopleInGroup >= 6 && countPeopleInGroup <= 12)
  32.                 {
  33.                     countMicrobus += countPeopleInGroup;
  34.                 }
  35.  
  36.                 else if (countPeopleInGroup >= 13 && countPeopleInGroup <= 25)
  37.                 {
  38.                     countSmallBus += countPeopleInGroup;
  39.                 }
  40.  
  41.                 else if (countPeopleInGroup >= 26 && countPeopleInGroup <= 40)
  42.                 {
  43.                     countBigBus += countPeopleInGroup;
  44.                 }
  45.  
  46.                 else if (countPeopleInGroup >= 41)
  47.                 {
  48.                     countTrain += countPeopleInGroup;
  49.                 }
  50.             }
  51.            int wholePeople = countCar + countMicrobus + countSmallBus + countBigBus + countTrain;
  52.             //Car
  53.            // double percentageCar = 0;
  54.            // percentageCar = countCar / wholePeople * 100;
  55.             Console.WriteLine("{0:F2}%",(double) countCar / wholePeople*100);
  56.  
  57.             //Microbus
  58.             //double percentageMicrobus = countMicrobus / wholePeople * 100;
  59.             Console.WriteLine("{0:F2}%", (double)countMicrobus / wholePeople *100);
  60.  
  61.             //SmallBus
  62.            // double percentageSmallBus = countSmallBus / wholePeople * 100;
  63.             Console.WriteLine("{0:F2}%", (double) countSmallBus / wholePeople *100);
  64.  
  65.             //BigBus
  66.            // double percentageBigBus = countBigBus / wholePeople * 100;
  67.             Console.WriteLine("{0:F2}%", (double)countBigBus / wholePeople *100);
  68.  
  69.             //Train
  70.            // double percentageTrain = countTrain / wholePeople * 100;
  71.             Console.WriteLine("{0:F2}%", (double)countTrain / wholePeople *100);
  72.         }
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement