Advertisement
dakata

PipesInBasin

Sep 11th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PipesInBasin
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             var vol = int.Parse(Console.ReadLine());
  10.             var debit1 = int.Parse(Console.ReadLine());
  11.             var debit2 = int.Parse(Console.ReadLine());
  12.             var hours = double.Parse(Console.ReadLine());
  13.  
  14.             double kol = debit1 * hours + debit2 * hours;
  15.  
  16.             if (vol >= kol)
  17.             {
  18.                 Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.",
  19.                     Math.Floor(kol /vol*100), Math.Floor(debit1 * hours / kol * 100), Math.Floor(debit2 * hours / kol * 100));
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine("For {0} hours the pool overflows with {1} liters.",
  24.                     hours, kol - vol);
  25.             }
  26.  
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement