Advertisement
NikolaySpasovTriset

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

Sep 16th, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         var poolVolume = int.Parse(Console.ReadLine());
  7.         var debitFirstPipeForHour = int.Parse(Console.ReadLine());
  8.         var debitSecondPipeForHour = int.Parse(Console.ReadLine());
  9.         var hoursWaterFlaws = double.Parse(Console.ReadLine());
  10.        
  11.         var debitTogether = debitFirstPipeForHour + debitSecondPipeForHour;
  12.  
  13.         double litersOverFlow = (debitTogether * hoursWaterFlaws) - poolVolume;
  14.  
  15.         double waterInPool = debitTogether * hoursWaterFlaws;
  16.  
  17.         var litersFromFirstPipe = debitFirstPipeForHour * hoursWaterFlaws;
  18.         var litersFromSecondPipe = debitSecondPipeForHour * hoursWaterFlaws;
  19.         var percentFullPull = (debitTogether * hoursWaterFlaws) / poolVolume * 100;
  20.         var percentFirstPipe = litersFromFirstPipe / waterInPool * 100;
  21.         var percentSecondPipe = litersFromSecondPipe / waterInPool * 100;
  22.  
  23.         if (waterInPool > poolVolume)
  24.         {
  25.             Console.WriteLine("For " + hoursWaterFlaws + " hours the pool overflows with " +
  26.                 litersOverFlow + " liters.");
  27.         }
  28.  
  29.         else if (waterInPool <= poolVolume)
  30.         {
  31.             Console.WriteLine("The pool is " + Math.Truncate(percentFullPull) + "% full. Pipe 1: " +
  32.             Math.Truncate(percentFirstPipe) + "%. Pipe 2: " + Math.Truncate(percentSecondPipe) + "%.");
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement