Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Logistics
- {
- class Program
- {
- static void Main(string[] args)
- {
- double cargoVolume = double.Parse(Console.ReadLine());
- double bus = 0;
- double truck = 0;
- double train = 0;
- double totalCargo = 0;
- for (int i = 1; i <= cargoVolume; i++)
- {
- double currentCargo = double.Parse(Console.ReadLine());
- if (currentCargo < 4)
- {
- bus += currentCargo;
- }
- else if (currentCargo < 12)
- {
- truck += currentCargo;
- }
- else
- {
- train += currentCargo;
- }
- totalCargo += currentCargo;
- }
- double average = (bus * 200 + truck * 175 + train * 120) / totalCargo;
- Console.WriteLine($"{average:f2}");
- Console.WriteLine($"{bus / totalCargo * 100:f2}%");
- Console.WriteLine($"{truck / totalCargo * 100:f2}%");
- Console.WriteLine($"{train / totalCargo * 100:f2}%");
- }
- }
- }
Add Comment
Please, Sign In to add comment