Advertisement
fbinnzhivko

02.Тръби в басейн

May 3rd, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         double v = double.Parse(Console.ReadLine());
  7.         double P1 = double.Parse(Console.ReadLine());
  8.         double P2 = double.Parse(Console.ReadLine());
  9.         double H = double.Parse(Console.ReadLine());
  10.        
  11.         double first = P1 * H;
  12.         double secound = P2 * H;
  13.         double total = first + secound;
  14.  
  15.         if (total <= v)
  16.         {
  17.             double prozent = total / (v / 100);
  18.            
  19.             double prozentfirst = first / (total / 100);
  20.             double prozentsecound = secound / (total / 100);
  21.  
  22.             Console.WriteLine("The pool is {0}% full. Pipe 1: {1:f0}%. Pipe 2: {2:f0}%.", (int)prozent, (int)prozentfirst, (int)prozentsecound);
  23.         }
  24.         else if (total >v)
  25.         {
  26.             double more = total - v;
  27.  
  28.             Console.WriteLine("For {0} hours the pool overflows with {1} liters.",H,more);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement