Guest User

Untitled

a guest
Mar 5th, 2017
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 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 Logistics
  8. {
  9.     class Logistics
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var n = int.Parse(Console.ReadLine());
  14.            
  15.             int microbus = 0;
  16.             int kamion = 0;
  17.             int vlak = 0;
  18.  
  19.             for (int i = 0; i < n; i++)
  20.             {
  21.                 int ton = int.Parse(Console.ReadLine());
  22.  
  23.                 if (ton <= 3)
  24.                 {
  25.                     microbus += ton;
  26.                 }
  27.                 else if (ton < 11)
  28.                 {
  29.                     kamion+= ton;
  30.                 }
  31.                 else if (ton > 12)
  32.                 {
  33.                     vlak+= ton;
  34.                 }
  35.             }
  36.             decimal tovari = microbus + kamion + vlak;
  37.             decimal average = (microbus * 200 + kamion * 175 + vlak * 120)/tovari;
  38.            
  39.             Console.WriteLine("{0:f2}", average);
  40.             Console.WriteLine("{0:f2}%", microbus/tovari * 100);
  41.             Console.WriteLine("{0:f2}%", kamion/tovari*100);
  42.             Console.WriteLine("{0:f2}%", vlak/tovari*100);
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment