grach

2016_March_26 PipeInPool

Dec 26th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 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 TubesInPool
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var V = int.Parse(Console.ReadLine());
  14.             var P1 = int.Parse(Console.ReadLine());
  15.             var P2 = int.Parse(Console.ReadLine());
  16.  
  17.             var H = double.Parse(Console.ReadLine());
  18.  
  19.             var debitP1 = P1 * H;
  20.             var debitP2 = P2 * H;
  21.  
  22.             var debit = debitP1 + debitP2;
  23.  
  24.             if (debit<=V)
  25.             {
  26.                 Console.Write("The pool is {0}% full. ", (int)(debit/V*100));
  27.                 Console.Write("Pipe 1: {0}%.", (int)((debitP1/debit)*100));
  28.                 Console.WriteLine(" Pipe 2: {0}%.", (int)((debitP2 / debit)*100));
  29.             }
  30.  
  31.             else if (debit>V)
  32.             {                
  33.                 Console.Write("For {0} hours", H);
  34.                 Console.WriteLine(" the pool overflows with {0:f1} liters.", (debit-V));
  35.             }                      
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment