Advertisement
bokoto83

тръбички

Jun 24th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 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.  
  7. namespace Pipes_In_Pool
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double v = double.Parse(Console.ReadLine());
  14.             double P1 = double.Parse(Console.ReadLine());
  15.             double P2 = double.Parse(Console.ReadLine());
  16.             double H = double.Parse(Console.ReadLine());
  17.  
  18.             double pipe1 = H * P1;
  19.             double pipe2 = H * P2;
  20.             double totalPipes = pipe1 + pipe2;
  21.             double percentPool = (totalPipes / v) * 100;
  22.  
  23.  
  24.             double percentPipe1 = (pipe1/totalPipes) * 100;
  25.             double percentPipe2 = (pipe2 / totalPipes) * 100;  
  26.  
  27.             if (totalPipes <= v)
  28.             {
  29.                 Console.WriteLine($"The pool is {percentPool}% full. Pipe 1: {percentPipe1:f2}%. Pipe 2: {percentPipe2:f2}%.");
  30.             }
  31.  
  32.             else
  33.             {
  34.                 double over = totalPipes - v;
  35.                 Console.WriteLine($"For {H:f2} hours the pool overflows with {over:f2} liters.");
  36.  
  37.             }
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement