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 SoftUniKamp
- {
- class SoftUniKamp
- {
- static void Main(string[] args)
- {
- int groop = int.Parse(Console.ReadLine());
- double sumPeopleCar = 0;
- double sumPeopleBus = 0;
- double sumPeopleMiniBus = 0;
- double sumPeopleBigBus = 0;
- double sumPeopleTrain = 0;
- double sumCar = 0;
- double sumBus = 0;
- double sumMiniBus = 0;
- double sumBigBus = 0;
- double sumTrain = 0;
- double sumPeople = 0;
- for (int i = 0; i < groop; i++)
- {
- int people = int.Parse(Console.ReadLine());
- sumPeople += people;
- if (people <= 5) sumPeopleCar += people;
- if (people > 5 && people <= 12) sumPeopleBus += people;
- if (people > 12 && people <= 25) sumPeopleMiniBus += people;
- if (people > 25 && people <= 40) sumPeopleBigBus += people;
- if (people > 40) sumPeopleTrain += people;
- }
- sumCar = (sumPeopleCar / sumPeople) * 100; // car
- sumBus = sumPeopleBus / sumPeople * 100; // bus
- sumMiniBus = sumPeopleMiniBus / sumPeople * 100; // minibus
- sumBigBus = sumPeopleBigBus / sumPeople * 100; // bigbus
- sumTrain = sumPeopleTrain / sumPeople * 100; // train
- Console.WriteLine("{0:f2}", sumCar);
- Console.WriteLine("{0:f2}", sumBus);
- Console.WriteLine("{0:f2}", sumMiniBus);
- Console.WriteLine("{0:f2}", sumBigBus);
- Console.WriteLine("{0:f2}", sumTrain);
- }
- }
- }
Add Comment
Please, Sign In to add comment