Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 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. namespace _19.BaseinTube
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int v = int.Parse(Console.ReadLine());
  13.             int p1 = int.Parse(Console.ReadLine());
  14.             int p2 = int.Parse(Console.ReadLine());
  15.             double h = double.Parse(Console.ReadLine());
  16.             if (p1 + p2 < v && v>= 1 && v<= 10000 && p1>=1 && p1<= 5000 && p2 >= 1 && p2 <= 5000 && h>= 1.0 && h<=24.0)
  17.             {
  18.                  p1 = p1 * h;
  19.                  
  20.                  p2 = p2 * h;
  21.                 var filled = ((p1 + p2) * 100) / v;
  22.                 var Pipe1 = 100 * p1 / (p1 + p2);
  23.                 var Pipe2 = 100 * p2 / (p1 + p2);
  24.                 Console.WriteLine("The pool is {0}%full. Pipe 1 : {1}%. Pipe 2: {2}%.", filled, Pipe1, Pipe2);
  25.             }
  26.             else if (p1 + p2 > v && v >= 1 && v <= 10000 && p1 >= 1 && p1 <= 5000 && p2 >= 1 && p2 <= 5000 && h >= 1.0 && h <= 24.0)
  27.             {
  28.                  p1 = p1 * h;
  29.                  p2 = p2 * h;
  30.                
  31.                 var overflowed = (p1 + p2) - v;
  32.                 Console.WriteLine("For {0} hours the pool overflows with {1} liters.", h, overflowed);
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement