Advertisement
koksibg

Pulbs_in_pool

Oct 8th, 2016
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Pulbs_in_pool
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var v =int.Parse(Console.ReadLine());
  10.             var p1 = int.Parse(Console.ReadLine());
  11.             var p2 = int.Parse(Console.ReadLine());
  12.             var h = Double.Parse(Console.ReadLine());
  13.             var bothPipe = (p1 * h) + (p2 * h);
  14.             if (v >= (p1*h) + (p2*h))
  15.             {
  16.                 var vPercent = (p1 * h) + (p2 * h);
  17.                 var vPercent1 = (vPercent / v) * 100;
  18.                 var p1Percent = (p1 * h) / bothPipe * 100;
  19.                 var p2Percent = (p2 * h) / bothPipe * 100;
  20.                 Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", (int)vPercent1, (int)p1Percent, (int)p2Percent);
  21.             }
  22.             else
  23.             {
  24.                 var overflow = bothPipe - v;
  25.                 Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, overflow);
  26.             }
  27.  
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement