Advertisement
koksibg

Pipes in pool

Jun 26th, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 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 PipesInPool
  8. {
  9.     class PipesInPool
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int v = int.Parse(Console.ReadLine()); // Debit
  14.             int PipeOne = int.Parse(Console.ReadLine()); // Debit First Pipe
  15.             int PipeTwo = int.Parse(Console.ReadLine()); // Debit os the second Pipe
  16.             double hours = double.Parse(Console.ReadLine());
  17.             double Capacity = hours * (PipeOne + PipeTwo);
  18.             if (Capacity <= v)
  19.             {
  20.                 double SumPercent = (Capacity / v) * 100;
  21.                 double PipeOnePercent = ((hours * PipeOne) / Capacity) * 100;
  22.                 double PipeTwoPercent = ((hours * PipeTwo) / Capacity) * 100;
  23.                 Console.WriteLine("The pool is {0}% full. Pipe 1: {1}%. Pipe 2: {2}%.", (int)SumPercent, (int)PipeOnePercent, (int)PipeTwoPercent);
  24.             }
  25.             if (Capacity > v)
  26.             {
  27.                 double difference = Capacity - v;
  28.                 Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hours, difference);
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement