Advertisement
koksibg

Untitled

Jun 27th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 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());
  14.             int PipeOne = int.Parse(Console.ReadLine());
  15.             int PipeTwo = int.Parse(Console.ReadLine());
  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}%.",
  24.                 (int)SumPercent, (int)PipeOnePercent, (int)PipeTwoPercent);
  25.             }
  26.             if (Capacity > v)
  27.             {
  28.                 double difference = Capacity - v;
  29.                 Console.WriteLine("For {0} hours the pool overflows with {1} liters.", hours, difference);
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement