Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
102
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.  
  3. namespace PipesInPool
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int v = int.Parse(Console.ReadLine());
  10.             int p1 = int.Parse(Console.ReadLine());
  11.             int p2 = int.Parse(Console.ReadLine());
  12.             double h = double.Parse(Console.ReadLine());
  13.  
  14.             double vp1 = p1 * h;
  15.             double vp2 = p2 * h;
  16.             double vp1p2 = vp1 + vp2;
  17.  
  18.             if (v > vp1p2)
  19.             {
  20.                 double v3 = (vp1p2 / v) * 100;
  21.                 double v3p1 = (vp1 / vp1p2) * 100;
  22.                 double v3p2 = (vp2 / vp1p2) * 100;
  23.  
  24.                 Console.WriteLine($"The pool is {v3:F2}% full. Pipe 1: {v3p1:F2}%. Pipe 2: {v3p2:F2}%.");
  25.             }
  26.             else
  27.             {
  28.                 double v4 = vp1p2 - v;
  29.                 Console.WriteLine($"For {h:F2} hours the pool overflows with {v4:F2} liters.");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement