Advertisement
bacco

Тръби в басейн

Jan 21st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             double pool = double.Parse(Console.ReadLine());
  11.             double pipe1 = double.Parse(Console.ReadLine());
  12.             double pipe2 = double.Parse(Console.ReadLine());
  13.             double time = double.Parse(Console.ReadLine());
  14.  
  15.  
  16.  
  17.             var capacityPipe1 = pipe1 * time;
  18.             var capacityPipe2 = pipe2 * time;
  19.             var capacityPipe1and2 = capacityPipe1 + capacityPipe2;
  20.  
  21.            
  22.             var pro1 = Math.Round(capacityPipe1 / (capacityPipe1and2 / 100),0);
  23.             var pro2 = Math.Round(capacityPipe2 / (capacityPipe1and2 / 100),0);
  24.             var poolProcentage = capacityPipe1and2 / (pool / 100);
  25.  
  26.             var overFlows = capacityPipe1and2 - pool;
  27.            
  28.            
  29.             if (capacityPipe1and2 < pool)
  30.             {
  31.                 Console.WriteLine($"The pool is {poolProcentage}% full. Pipe 1: {pro1}%. Pipe 2: {pro2}%.");
  32.  
  33.             }
  34.             else if (capacityPipe1and2 > pool)
  35.             {
  36.                 Console.WriteLine($"For {time} hours the pool overflows with {overFlows:0.0} liters.");
  37.             }
  38.  
  39.  
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement