Advertisement
Spocoman

01. Pipes In Pool

Nov 16th, 2021 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PipesInPool
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             double volume = double.Parse(Console.ReadLine());
  10.             double pipe1 = double.Parse(Console.ReadLine());
  11.             double pipe2 = double.Parse(Console.ReadLine());
  12.             double hour = double.Parse(Console.ReadLine());
  13.             double poolV = (pipe1 + pipe2) * hour;
  14.             double poolP = poolV / volume;
  15.  
  16.             if (volume >= poolV)
  17.             {
  18.                 Console.WriteLine($"The pool is {poolP * 100:F2}% full. Pipe 1: " +
  19.                     $"{pipe1 / poolV * hour * 100:F2}%. Pipe 2: {pipe2 / poolV * hour * 100:F2}%.");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine($"For {hour} hours the pool overflows with {poolV - volume:F2} liters.");
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement